Long march towards more structured text

This commit is contained in:
Aaron Gyes
2021-11-12 04:20:51 -08:00
parent c16e30931b
commit ac1df310c8
10 changed files with 35 additions and 56 deletions

View File

@@ -1,4 +1,4 @@
.. _cmd-exit:
.. program::exit:
exit - exit the shell
=====================
@@ -6,13 +6,11 @@ exit - exit the shell
Synopsis
--------
::
exit [STATUS]
**exit** [*code*]
Description
-----------
``exit`` causes fish to exit. If ``STATUS`` is supplied, it will be converted to an integer and used as the exit status. Otherwise, the exit status will be that of the last command executed.
``exit`` is a special builtin that causes the shell to exit. If ``code`` is specified, the exit status is the eight least significant bits of ``n``. Otherwise, the exit status will be that of the last command executed.
If exit is called while sourcing a file (using the :ref:`source <cmd-source>` builtin) the rest of the file will be skipped, but the shell itself will not exit.
If exit is called while sourcing a file (using the :program:`source` builtin) the rest of the file will be skipped, but the shell itself will not exit.

View File

@@ -6,9 +6,7 @@ false - return an unsuccessful result
Synopsis
--------
::
false
**false**
Description
-----------

View File

@@ -1,4 +1,4 @@
.. _cmd-fish:
.. program::fish
fish - the friendly interactive shell
=====================================

View File

@@ -6,21 +6,19 @@ fish_add_path - add to the path
Synopsis
--------
::
**fish_add_path** *path*...
fish_add_path [paths...]
fish_add_path (-h | --help)
fish_add_path [(-g | --global) | (-U | --universal) | (-P | --path)] [(-m | --move)] [(-a | --append) | (-p | --prepend)] [(-v | --verbose) | (-n | --dry-run)] [paths...]
**fish_add_path** [(*-g* | *--global*) | (*-U* | *--universal*) | (*-P* | *--path*)] [(*-m* | *--move*)] [(*-a* | *--append*) | (*-p* | *--prepend*)] [(*-v* | *--verbose*) | (*-n* | *--dry-run*)] *paths*...
Description
-----------
``fish_add_path`` is a simple way to add more components to fish's $PATH. It does this by adding the components either to $fish_user_paths or directly to $PATH (if the ``--path`` switch is given).
:program:`fish_add_path` is a simple way to add more components to fish's :envvar:`PATH`. It does this by adding the components either to $fish_user_paths or directly to $PATH (if the ``--path`` switch is given).
It is (by default) safe to use ``fish_add_path`` in config.fish, or it can be used once, interactively, and the paths will stay in future because of :ref:`universal variables <variables-universal>`. This is a "do what I mean" style command, if you need more control, consider modifying the variable yourself.
Components are normalized by :ref:`realpath <cmd-realpath>`. This means that trailing slashes are ignored and relative paths are made absolute (but symlinks are not resolved). If a component already exists, it is not added again and stays in the same place unless the ``--move`` switch is given.
Components are normalized by :program:`realpath`. Trailing slashes are ignored and relative paths are made absolute (but symlinks are not resolved). If a component already exists, it is not added again and stays in the same place unless the ``--move`` switch is given.
Components are added in the order they are given, and they are prepended to the path unless ``--append`` is given (if $fish_user_paths is used, that means they are last in $fish_user_paths, which is itself prepended to $PATH, so they still stay ahead of the system paths).

View File

@@ -1,4 +1,4 @@
.. _cmd-fish_indent:
.. program::fish_indent
fish_indent - indenter and prettifier
=====================================
@@ -6,15 +6,13 @@ fish_indent - indenter and prettifier
Synopsis
--------
::
fish_indent [OPTIONS] [FILE...]
**fish_indent** [*OPTIONS*] [*FILE*...]
Description
-----------
``fish_indent`` is used to indent a piece of fish code. ``fish_indent`` reads commands from standard input or the given filenames and outputs them to standard output or a specified file (if ``-w`` is given).
:program:`fish_indent` is used to indent a piece of fish code. :program:`fish_indent` reads commands from standard input or the given filenames and outputs them to standard output or a specified file (if ``-w`` is given).
The following options are available:
@@ -30,7 +28,7 @@ The following options are available:
- ``--html`` outputs HTML, which supports syntax highlighting if the appropriate CSS is defined. The CSS class names are the same as the variable names, such as ``fish_color_command``.
- ``-d`` or ``--debug=DEBUG_CATEGORIES`` enable debug output and specify a pattern for matching debug categories. See :ref:`Debugging <debugging-fish>` in :ref:`fish(1) <cmd-fish>` for details.
- ``-d`` or ``--debug=DEBUG_CATEGORIES`` enable debug output and specify a pattern for matching debug categories. See :ref:`Debugging <debugging-fish>` in :program:`fish` (1) for details.
- ``-o`` or ``--debug-output=DEBUG_FILE`` specify a file path to receive the debug output, including categories and ``fish_trace``. The default is stderr.

View File

@@ -1,4 +1,4 @@
.. _cmd-realpath:
.. program::realpath
realpath - convert a path to an absolute path without symlinks
==============================================================
@@ -6,24 +6,16 @@ realpath - convert a path to an absolute path without symlinks
Synopsis
--------
::
realpath PATH
**realpath** [*options*] *PATH*
Description
-----------
.. only:: builder_man
:program:`realpath` follows all symbolic links encountered for the provided ``PATH``, printing the absolute path resolved. :program:`fish` provides a :command:`realpath`-alike builtin intended to be enrich systems where no such command is installed
by default.
NOTE: This page documents the fish builtin ``realpath``.
To see the documentation on the ``realpath`` command you might have,
use ``command man realpath``.
``realpath`` resolves a path to its absolute path.
fish provides a ``realpath`` builtin as a fallback for systems where there is no ``realpath`` command, your OS might provide a version with more features.
If a ``realpath`` command exists, it will be preferred, so if you want to use the builtin you should use ``builtin realpath`` explicitly.
If a :command:`realpath` command exists, it will be preferred.
``builtin realpath`` will eplicitly use this implementation.
The following options are available:

View File

@@ -1,4 +1,4 @@
.. _cmd-return:
.. proggram::return:
return - stop the current inner function
========================================
@@ -6,31 +6,26 @@ return - stop the current inner function
Synopsis
--------
::
function NAME; [COMMANDS...;] return [STATUS]; [COMMANDS...;] end
**return** [*n*]
Description
-----------
``return`` halts a currently running function. The exit status is set to ``STATUS`` if it is given.
:program:`return` halts a currently running function.
The exit status is set to ``n`` if it is given.
If :program:`return` is invoked outside of a function or dot script it is equivalent to exit.
It is usually added inside of a conditional block such as an :ref:`if <cmd-if>` statement or a :ref:`switch <cmd-switch>` statement to conditionally stop the executing function and return to the caller, but it can also be used to specify the exit status of a function.
It is often added inside of a conditional block such as an :program:`if` statement or a :program:`switch` statement to conditionally stop the executing function and return to the caller; it can also be used to specify the exit status of a function.
If run at the top level of a script, it exits that script and returns the given status, like :ref:`exit <cmd-exit>`. If run at the top level in an interactive session, it will set ``$status``, but not exit the shell.
If at the top level of a script, it exits with the given status, like :program:`exit`.
If at the top level in an interactive session, it will set :envvar:`status`, but not exit the shell.
Example
-------
The following code is an implementation of the false command as a fish function
An implementation of the false command as a fish function:
::
function false
return 1
end