mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 19:03:38 +08:00
Teach help to pick the correct page
Given that we no longer have that massive "index" page with everything, it's become harder to open the correct section immediately. So this hardcodes the section titles for each page in help itself. This was half-automated with grep -o 'a class="headerlink" href="#[^"]*"' /usr/share/doc/fish/faq.html | sort -u | string replace -r '.*#' '' | string trim -c '"' The completions still need to be adjusted.
This commit is contained in:
parent
18e332772d
commit
d5cba5fe12
|
@ -111,12 +111,53 @@ function help --description 'Show help for the fish shell'
|
|||
end
|
||||
end
|
||||
|
||||
# HACK: Hardcode all section titles for each page.
|
||||
# This could possibly be automated.
|
||||
|
||||
# All sections in "language.html"
|
||||
set -l langpages argument-handling autoloading-functions brace-expansion \
|
||||
builtin-commands combining-different-expansions combining-lists-cartesian-product \
|
||||
command-substitution comments conditions defining-aliases escaping-characters expand exporting-variables \
|
||||
functions home-directory-expansion index-range-expansion input-output-redirection job-control lists \
|
||||
loops-and-blocks more-on-universal-variables overriding-variables-for-a-single-command pager-color-variables \
|
||||
path-variables piping quotes shell-variable-and-function-names \
|
||||
shell-variables special-variables syntax-highlighting-variables syntax-overview \
|
||||
terminology the-fish-language the-status-variable variable-expansion \
|
||||
variable-scope variable-scope-for-functions variables-locale wildcards-globbing
|
||||
|
||||
# All sections in "interactive.html"
|
||||
set -l interactivepages abbreviations autosuggestions command-line-editor configurable-greeting \
|
||||
copy-and-paste-kill-ring custom-bindings directory-stack emacs-mode-commands \
|
||||
help interactive-use multiline-editing navigating-directories private-mode \
|
||||
programmable-prompt programmable-title searchable-command-history shared-bindings \
|
||||
syntax-highlighting tab-completion vi-mode-command vi-mode-commands \
|
||||
vi-mode-insert vi-mode-visual
|
||||
|
||||
set -l for_bash_pages arithmetic-expansion blocks-and-loops builtins-and-other-commands \
|
||||
command-substitutions fish-for-bash-users heredocs process-substitution prompts \
|
||||
quoting special-variables string-manipulation test-test variables wildcards-globs
|
||||
|
||||
set -l faqpages frequently-asked-questions how-can-i-use-as-a-shortcut-for-cd \
|
||||
how-do-i-change-the-greeting-message how-do-i-check-whether-a-variable-is-defined \
|
||||
how-do-i-check-whether-a-variable-is-not-empty how-do-i-customize-my-syntax-highlighting-colors \
|
||||
how-do-i-get-the-exit-status-of-a-command how-do-i-make-fish-my-default-shell \
|
||||
how-do-i-run-a-command-every-login-what-s-fish-s-equivalent-to-bashrc-or-profile how-do-i-run-a-command-from-history \
|
||||
how-do-i-run-a-subcommand-the-backtick-doesn-t-work how-do-i-set-my-prompt \
|
||||
how-do-i-set-or-clear-an-environment-variable i-accidentally-entered-a-directory-path-and-fish-changed-directory-what-happened \
|
||||
i-m-getting-weird-graphical-glitches-a-staircase-effect-ghost-characters i-m-seeing-weird-output-before-each-prompt-when-using-screen-what-s-wrong \
|
||||
my-command-pkg-config-gives-its-output-as-a-single-long-string my-command-prints-no-matches-for-wildcard-but-works-in-bash \
|
||||
the-open-command-doesn-t-work uninstalling-fish \
|
||||
what-is-the-equivalent-to-this-thing-from-bash-or-other-shells where-can-i-find-extra-tools-for-fish \
|
||||
why-does-my-prompt-show-a-i why-doesn-t-history-substitution-etc-work \
|
||||
why-doesn-t-set-ux-exported-universal-variables-seem-to-work why-won-t-ssh-scp-rsync-connect-properly-when-fish-is-my-login-shell
|
||||
|
||||
|
||||
set -l fish_help_page
|
||||
switch "$fish_help_item"
|
||||
case "."
|
||||
set fish_help_page "cmds/source.html"
|
||||
case globbing
|
||||
set fish_help_page "index.html#expand"
|
||||
set fish_help_page "language.html#expand"
|
||||
case (builtin -n) (__fish_print_commands)
|
||||
# If the docs aren't installed, __fish_print_commands won't print anything
|
||||
# Since we document all our builtins, check those at least.
|
||||
|
@ -136,6 +177,14 @@ function help --description 'Show help for the fish shell'
|
|||
set fish_help_page faq.html
|
||||
case fish-for-bash-users
|
||||
set fish_help_page fish_for_bash_users.html
|
||||
case $faqpages
|
||||
set fish_help_page "faq.html#$fish_help_item"
|
||||
case $for_bash_pages
|
||||
set fish_help_page "fish_for_bash_users.html#$fish_help_item"
|
||||
case $langpages
|
||||
set fish_help_page "language.html#$fish_help_item"
|
||||
case $interactivepages
|
||||
set fish_help_page "interactive.html#$fish_help_item"
|
||||
case ''
|
||||
set fish_help_page "index.html"
|
||||
case "*"
|
||||
|
|
Loading…
Reference in New Issue
Block a user