Allow help to open the tutorial

This is unambiguous because all the anchors in tutorial.html begin
with "tut".
This commit is contained in:
Fabian Homborg 2017-06-14 13:52:24 +02:00
parent 82359ceb22
commit cec2999983
3 changed files with 35 additions and 2 deletions

View file

@ -10,6 +10,7 @@
-
- Improved completions for `killall` (#4052), `ln` (#4090) and `zypper` (#4079).
- Implemented `string lower` and `string upper` (#4080).
- `help` can now open the tutorial.
---

View file

@ -72,3 +72,31 @@ complete -c help -x -a vi-mode --description 'Vi mode commands'
complete -c help -x -a vi-mode-command --description 'Command mode'
complete -c help -x -a vi-mode-insert --description 'Insert mode'
complete -c help -x -a vi-mode-visual --description 'Visual mode'
# Tutorial
complete -c help -x -a tutorial --description 'Tutorial'
complete -c help -x -a tut_autoload --description 'Autoloading Functions'
complete -c help -x -a tut_autosuggestions --description 'Autosuggestions'
complete -c help -x -a tut_combiners --description 'Combiners (And, Or, Not)'
complete -c help -x -a tut_command_substitutions --description 'Command Substitutions'
complete -c help -x -a tut_conditionals --description 'Conditionals (If, Else, Switch)'
complete -c help -x -a tut_exit_status --description 'Exit Status'
complete -c help -x -a tut_exports --description 'Exports (Shell Variables)'
complete -c help -x -a tut_functions --description 'Functions'
complete -c help -x -a tut_getting_help --description 'Getting Help'
complete -c help -x -a tut_learning_Fish --description 'Learning fish'
complete -c help -x -a tut_lists --description 'Lists'
complete -c help -x -a tut_loops --description 'Loops'
complete -c help -x -a tut_more --description 'Ready for more?'
complete -c help -x -a tut_path --description '$PATH'
complete -c help -x -a tut_pipes_and_redirections --description 'Pipes and Redirections'
complete -c help -x -a tut_prompt --description 'Prompt'
complete -c help -x -a tut_running_commands --description 'Running Commands'
complete -c help -x -a tut_semicolon --description 'Separating Commands (Semicolon)'
complete -c help -x -a tut_startup --description "Startup (Where's .bashrc?)"
complete -c help -x -a tut_syntax_highlighting --description 'Syntax Highlighting'
complete -c help -x -a tut_tab_completions --description 'Tab Completions'
complete -c help -x -a tut_universal --description 'Universal Variables'
complete -c help -x -a tut_variables --description 'Variables'
complete -c help -x -a tut_why_fish --description 'Why fish?'
complete -c help -x -a tut_wildcards --description 'Wildcards'

View file

@ -89,8 +89,6 @@ function help --description 'Show help for the fish shell'
set -l fish_help_item $argv[1]
switch "$fish_help_item"
case ""
set fish_help_page index.html
case "."
set fish_help_page "commands.html\#source"
case globbing
@ -99,7 +97,13 @@ function help --description 'Show help for the fish shell'
set fish_help_page "commands.html\#$fish_help_item"
case $help_topics
set fish_help_page "index.html\#$fish_help_item"
case 'tut_*'
set fish_help_page "tutorial.html\#$fish_help_item"
case tutorial
set fish_help_page "tutorial.html"
case "*"
# If $fish_help_item is empty, this will fail,
# and $fish_help_page will end up as index.html
if type -q -f $fish_help_item
# Prefer to use fish's man pages, to avoid
# the annoying useless "builtin" man page bash