fisher/functions/fisher_help.fish
Jorge Bucaran 0ae4c97326 Power up search Close #115,#128
* Search now has a color display mode enabled by default when listing
  records for human consumption, but continues to produce easy to parse
  output when selecting specific fields.

* The following example queries:

  * fisher search --name
  * fisher search --url
  * fisher search --name --url
  * fisher search --tag=prompt --name

  and so forth continue to display easy to parse output.

* The following example queries:

  * fisher search
  * fisher search --name=fishtape
  * fisher search --tag=prompt
  * fisher search --author=joe

  display in color by default and support multiple formats using the
  --format option described below. The colors used are selected from
  $fish_color_* variables for best results.

* To disable color output, use --no-color. To customize the display
  format use any of the following keywords:

  * --format=*oneline* (default)
  * --format=*short*
  * --format=*verbose*
  * --format=*longline*
  * --format=*raw*

* Search now shows unique records when listing --authors only. #128
2016-02-26 16:59:47 +09:00

83 lines
2.1 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 available documentation\n"
printf " -g --guides List available guides\n"
printf " -h --help Show usage help\n"
printf " --usage[=<cmd>] Display command usage\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