fisher/functions/fisher_help.fish
Jorge Bucaran ebec1eaa01
Fisherman 1.0 RC
* Deprecate fisher --list in favor of a new command fisher list.
  The behavior is roughly the same. See fisher help list for
  usage. tl;dr: Use list to query the local system / cache and
  search to query the index.

* Teach fisher_plugin_walk about fish_postexec,
  fish_command_not_found and fish_preexec event emitters and
  erase them during uninstall if they were defined in a snippet.

* Fisherman now recognizes the following aliases by default:
  i for install, u for update, l for list, s for search and h
  for help.

* Large documentation rewrite. Better, simpler, more concise
  and more consistent.

* Fisherman now detects if users have modified their fish
  prompt using fish_config and if so, uninstalls $fisher_prompt.
2016-02-29 23:13:29 +09:00

82 lines
2 KiB
Fish

function fisher_help -d "Show help"
if not set -q argv[1]
man fisher
return
end
set -l option
set -l value
getopts $argv | while read -l 1 2
switch "$1"
case _
set option man
set value $2
case a all
set option guides commands
set value $2
case g guides
set option $option guides
set value $2
case commands
set option $option commands
set value $2
case usage
set option usage
set value $value $2
case h
printf "Usage: fisher help [<keyword>] [--all] [--guides] [--help]\n\n"
printf " -a --all List all the documentation\n"
printf " -g --guides List available guides\n"
printf " -h --help Show usage help\n"
return
case \*
printf "fisher: '%s' is not a valid option.\n" $1 > /dev/stderr
fisher_help -h > /dev/stderr
return 1
end
end
if not set -q option[1]
set option commands
end
switch "$option"
case man
set -l value (printf "%s\n" $value | awk '{ print tolower($0) }')
switch "$value"
case me fisher fisherman
man fisher
case \*
man fisher-$value
end
case usage
__fisher_help_usage $value
case \*
if test "$value" != bare
fisher --help=$option
return
end
begin
if contains -- commands $option
__fisher_help_commands
end
if contains -- guides $option
__fisher_help_guides
end
end | sed 's/^/ /;s/;/'\t'/' | column -ts\t
end
end