From 1e13c600594aef231c70e19db5279f90e28f6860 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Mon, 3 May 2021 18:15:24 +0200 Subject: [PATCH] docs: Link relevant language sections from the tutorial This allows us to keep the tutorial more focussed and leave the more in-depth information in the "language" part of the documentation. --- doc_src/language.rst | 2 ++ doc_src/tutorial.rst | 29 +++++++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/doc_src/language.rst b/doc_src/language.rst index 15b3984f7..2e75ce766 100644 --- a/doc_src/language.rst +++ b/doc_src/language.rst @@ -370,6 +370,8 @@ Some examples:: For more, see the documentation for the builtins or the :ref:`Conditionals ` section of the tutorial. +.. _syntax-loops-and-blocks: + Loops and blocks ---------------- diff --git a/doc_src/tutorial.rst b/doc_src/tutorial.rst index 511a27f8f..f57c6d90d 100644 --- a/doc_src/tutorial.rst +++ b/doc_src/tutorial.rst @@ -51,9 +51,7 @@ Fish runs commands like other shells: you type a command, followed by its argume hello world -This runs the command ``echo`` with the arguments ``hello`` and ``world``. - -You can include a literal space in an argument with a backslash, or by using single or double quotes:: +This runs the command ``echo`` with the arguments ``hello`` and ``world``. In this case that's the same as one argument ``hello world``, but in many cases it's not. If you need to pass an argument that includes a space, you can :ref:`escape ` with a backslash, or :ref:`quote ` it using single or double quotes:: > mkdir My\ Files > cp ~/Some\ File 'My Files' @@ -61,15 +59,10 @@ You can include a literal space in an argument with a backslash, or by using sin Some File -Commands can be chained with semicolons. - - Getting Help ------------ -Fish has excellent help and man pages. Run ``help`` to open help in a web browser, and ``man`` to open it in a man page. You can also ask for help with a specific command, for example, ``help set`` to open in a web browser, or ``man set`` to see it in the terminal. - - +Run ``help`` to open fish's help in a web browser, and ``man`` with the page (like ``fish-language``) to open it in a man page. You can also ask for help with a specific command, for example, ``help set`` to open in a web browser, or ``man set`` to see it in the terminal. :: @@ -141,6 +134,7 @@ Especially powerful is the recursive wildcard ** which searches directories recu If that directory traversal is taking a long time, you can :kbd:`Control`\ +\ :kbd:`C` out of it. +For more, see :ref:`Wildcards `. Pipes and Redirections ---------------------- @@ -164,6 +158,7 @@ To redirect stdout and stderr into one file, you need to first redirect stdout, > make > make_output.txt 2>&1 +For more, see :ref:`Input and output redirections ` and :ref:`Pipes `. Autosuggestions --------------- @@ -275,6 +270,8 @@ You can erase (or "delete") a variable with ``-e`` or ``--erase`` > env | grep MyVariable (no output) +For more, see :ref:`Variable expansion `. + .. _tut-exports: Exports (Shell Variables) @@ -296,6 +293,8 @@ This works the other way around as well! If fish is started by something else, i Note that exported variables can be local or global or universal - "exported" is not a :ref:`scope `. Usually you'd make them global via ``set -gx MyVariable SomeValue``. +For more, see :ref:`Exporting variables `. + .. _tut-lists: Lists @@ -375,6 +374,9 @@ Lists adjacent to other lists or strings are expanded as :ref:`cartesian product This is similar to :ref:`Brace expansion `. +For more, see :ref:`Lists `. + + Command Substitutions --------------------- @@ -410,6 +412,7 @@ Unlike other shells, fish does not split command substitutions on any whitespace -lgobject-2.0 -lglib-2.0 +For more, see :ref:`Command substitution `. .. _tut-semicolon: @@ -446,6 +449,8 @@ This indicates how the command fared - 0 usually means success, while the others There is also a ``$pipestatus`` list variable for the exit statuses [#]_ of processes in a pipe. +For more, see :ref:`The status variable `. + .. [#] or "stati" if you prefer, or "statūs" if you've time-travelled from ancient Rome or work as a latin teacher .. _tut-combiners: @@ -545,6 +550,7 @@ There is also a :ref:`switch ` command:: Note that :ref:`case ` does not fall through, and can accept multiple arguments or (quoted) wildcards. +For more, see :ref:`Conditions `. Functions --------- @@ -575,6 +581,8 @@ You can see the source for any function by passing its name to ``functions``:: command ls -G $argv end +For more, see :ref:`Functions `. + .. [#] There is a function called :ref:`alias `, but it's just a shortcut to make functions. Loops @@ -604,6 +612,7 @@ Iterating over a list of numbers can be done with ``seq``:: touch file_$x.txt end +For more, see :ref:`Loops and blocks `. Prompt ------ @@ -642,7 +651,7 @@ This prompt would look like: :red:`/home/tutorial >` _ -You can choose among some sample prompts by running ``fish_config prompt``. +You can choose among some sample prompts by running ``fish_config`` for a web UI or ``fish_config prompt`` for a simpler version inside your terminal. $PATH -----