diff --git a/share/completions/help.fish b/share/completions/help.fish index d96745ab4..f0c1fa0a5 100644 --- a/share/completions/help.fish +++ b/share/completions/help.fish @@ -2,10 +2,8 @@ # Completions for the help command # -if test -f "$__fish_help_dir/commands.html" - for i in case (sed -n < $__fish_help_dir/commands.html -e "s/.*.*/\1/p") - complete -c help -x -a $i --description "Help for the specified command" - end +if test -d "$__fish_datadir/man/man1/" + complete -c help -x -a '(__fish_print_commands)' --description "Help for this command" end complete -c help -x -a syntax --description 'Introduction to the fish syntax' diff --git a/share/functions/__fish_print_commands.fish b/share/functions/__fish_print_commands.fish new file mode 100644 index 000000000..9056bc525 --- /dev/null +++ b/share/functions/__fish_print_commands.fish @@ -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 diff --git a/share/functions/help.fish b/share/functions/help.fish index 4164c01ad..88b87dbb9 100644 --- a/share/functions/help.fish +++ b/share/functions/help.fish @@ -92,12 +92,7 @@ function help --description "Show help for the fish shell" set fish_help_page difference.html case globbing set fish_help_page "index.html\#expand" - - # 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/.*.*/\2/p' $__fish_help_dir/commands.html) + case (__fish_print_commands) set fish_help_page "commands.html\#$fish_help_item" case $help_topics set fish_help_page "index.html\#$fish_help_item"