__fish_print_commands: remove code clone

Also, use it for help completions also on embed-data builds.
This commit is contained in:
Johannes Altmanninger
2025-10-12 06:08:40 +02:00
parent 9b44138917
commit 189a2e90dd
2 changed files with 6 additions and 11 deletions

View File

@@ -1,6 +1,4 @@
if test -d "$__fish_data_dir/man/man1/" complete -c help -x -a '(__fish_print_commands)' -d 'Help for this command'
complete -c help -x -a '(__fish_print_commands)' -d 'Help for this command'
end
# Help topics in index.html # Help topics in index.html
# This was semi-automated with `grep 'class="anchor"' -A1 /usr/share/doc/fish/index.html # This was semi-automated with `grep 'class="anchor"' -A1 /usr/share/doc/fish/index.html

View File

@@ -1,14 +1,11 @@
# localization: skip(private) # localization: skip(private)
function __fish_print_commands --description "Print a list of documented fish commands" function __fish_print_commands --description "Print a list of documented fish commands"
if set -q __fish_data_dir[1] && test -d $__fish_data_dir/man/man1/ if set -q __fish_data_dir[1] && test -d $__fish_data_dir/man/man1/
for file in $__fish_data_dir/man/man1/**.1* printf %s\n $__fish_data_dir/man/man1/**.1*
string replace -r '.*/' '' -- $file | else
string replace -r '.1(.gz)?$' '' | status list-files man/man1/ 2>/dev/null
string match -rv '^fish-(?:changelog|completions|doc|tutorial|faq|for-bash-users|interactive|language|releasenotes|terminal-compatibility)$' end |
end
end
status list-files man/man1/ 2>/dev/null |
string replace -r '.*/' '' | string replace -r '.*/' '' |
string replace -r '.1(.gz)?$' '' | string replace -r '.1(.gz)?$' '' |
string match -rv '^fish-(?:changelog|completions|doc|tutorial|faq|for-bash-users|interactive|language|releasenotes)$' string match -rv '^fish-(?:changelog|completions|doc|tutorial|faq|for-bash-users|interactive|language|releasenotes|terminal-compatibility)$'
end end