cmd

package
v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Example (HelpCmd)
_ = helpCmd(cli.Args{}, nil)
Output:

Usage: jump [COMMAND ...]

Jump to a fuzzy-matched directory passed as an argument.

Commands:
  cd           Fuzzy match a directory to jump to.
  chdir        Update the score of directory during chdir.
  clean        Cleans the database of inexisting entries.
  forget       Removes the current directory from the database.
  hint         Hints relevant paths for jumping.
  pin          Pin a directory to a search term.
  pins         Lists all the pinned search terms.
  shell        Display a shell integration script.
  top          Lists the directories as they are scored.
  unpin        Unpin a search term.

Options:
  --help       Show this screen.
  --version    Show version.
Example (ShellCmd_Bash)
_ = shellCmd(cli.Args{"bash"}, nil)
Output:

# Put the line below in ~/.bashrc or ~/bash_profile:
#
#   eval "$(jump shell bash)"
#
# The following lines are autogenerated:

__jump_prompt_command() {
  local status=$?
  jump chdir && return $status
}

__jump_hint() {
  local term="${COMP_LINE/#j /}"
  jump hint $term
}

j() {
  local dir="$(jump cd $@)"
  test -d "$dir"  && cd "$dir"
}

[[ "$PROMPT_COMMAND" =~ __jump_prompt_command ]] || {
  PROMPT_COMMAND="__jump_prompt_command;$PROMPT_COMMAND"
}

complete -o dirnames -C '__jump_hint' j
Example (ShellCmd_Bind)
_ = shellCmd(cli.Args{"bash", "--bind=z"}, nil)
Output:

# Put the line below in ~/.bashrc or ~/bash_profile:
#
#   eval "$(jump shell bash)"
#
# The following lines are autogenerated:

__jump_prompt_command() {
  local status=$?
  jump chdir && return $status
}

__jump_hint() {
  local term="${COMP_LINE/#z /}"
  jump hint $term
}

z() {
  local dir="$(jump cd $@)"
  test -d "$dir"  && cd "$dir"
}

[[ "$PROMPT_COMMAND" =~ __jump_prompt_command ]] || {
  PROMPT_COMMAND="__jump_prompt_command;$PROMPT_COMMAND"
}

complete -o dirnames -C '__jump_hint' z
Example (ShellCmd_Fish)
_ = shellCmd(cli.Args{"fish"}, nil)
Output:

# Put the line below in ~/.config/fish/config.fish:
#
#   status --is-interactive; and source (jump shell fish | psub)
#
# The following lines are autogenerated:

function __jump_add --on-variable PWD
  status --is-command-substitution; and return
  jump chdir
end

function __jump_hint
  set -l term (string replace -r '^j ' '' -- (commandline -cp))
  jump hint $term
end

function j
  set -l dir (jump cd $argv)
  test -d "$dir"; and cd "$dir"
end

complete --command j --exclusive --arguments '(__jump_hint)'
Example (ShellCmd_Zsh)
_ = shellCmd(cli.Args{"zsh"}, nil)
Output:

# Put the line below in ~/.zshrc:
#
#   eval "$(jump shell zsh)"
#
# The following lines are autogenerated:

__jump_chpwd() {
  jump chdir
}

jump_completion() {
  reply=(${(f)"$(jump hint $@)"})
}

j() {
  local dir="$(jump cd $@)"
  test -d "$dir" && cd "$dir"
}

typeset -gaU chpwd_functions
chpwd_functions+=__jump_chpwd

compctl -U -K jump_completion j
Example (VersionCmd)
_ = versionCmd(cli.Args{}, nil)
Output:

0.20.0

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL