mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
add __fish_print_commands and use it for help
This commit is contained in:
parent
fc898eff65
commit
27e4ece24f
3 changed files with 8 additions and 10 deletions
|
@ -2,10 +2,8 @@
|
||||||
# Completions for the help command
|
# Completions for the help command
|
||||||
#
|
#
|
||||||
|
|
||||||
if test -f "$__fish_help_dir/commands.html"
|
if test -d "$__fish_datadir/man/man1/"
|
||||||
for i in case (sed -n < $__fish_help_dir/commands.html -e "s/.*<h[12]><a class=\"anchor\" name=\"\([^\"]*\)\">.*/\1/p")
|
complete -c help -x -a '(__fish_print_commands)' --description "Help for this command"
|
||||||
complete -c help -x -a $i --description "Help for the specified command"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
complete -c help -x -a syntax --description 'Introduction to the fish syntax'
|
complete -c help -x -a syntax --description 'Introduction to the fish syntax'
|
||||||
|
|
5
share/functions/__fish_print_commands.fish
Normal file
5
share/functions/__fish_print_commands.fish
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
function __fish_print_commands --description "Print a list of documented fish commands"
|
||||||
|
if test -d $__fish_datadir/man/man1/
|
||||||
|
find /usr/share/fish/man/man1/ -type f -name \*.1 -execdir basename '{}' .1 ';'
|
||||||
|
end
|
||||||
|
end
|
|
@ -92,12 +92,7 @@ function help --description "Show help for the fish shell"
|
||||||
set fish_help_page difference.html
|
set fish_help_page difference.html
|
||||||
case globbing
|
case globbing
|
||||||
set fish_help_page "index.html\#expand"
|
set fish_help_page "index.html\#expand"
|
||||||
|
case (__fish_print_commands)
|
||||||
# This command substitution should locate all commands with
|
|
||||||
# documentation. It's a bit of a hack, since it relies on the
|
|
||||||
# Doxygen markup format to never change.
|
|
||||||
|
|
||||||
case (sed -n 's/.*<h[12]><a class="anchor" \(id\|name\)="\([^"]*\)">.*/\2/p' $__fish_help_dir/commands.html)
|
|
||||||
set fish_help_page "commands.html\#$fish_help_item"
|
set fish_help_page "commands.html\#$fish_help_item"
|
||||||
case $help_topics
|
case $help_topics
|
||||||
set fish_help_page "index.html\#$fish_help_item"
|
set fish_help_page "index.html\#$fish_help_item"
|
||||||
|
|
Loading…
Reference in a new issue