Skip to content

Commit

Permalink
Reference more non-fish shell builtins that have relevant differences
Browse files Browse the repository at this point in the history
When writing scripts for other shells, it can be confusing and annoying
that our `man` function shadows other manual pages, for example `exec(1p)`
from [Linux man-pages]. I almost never want to see the fish variant for such
contended cases (which obviuosly don't include fish-specific commands like
`string`, only widely-known shell builtins).

For the contented cases like `exec`, the POSIX documentation is more
substantial and useful, since it describes a (sub)set of languages widely
used for scripting.

Because of this I think we should stop overriding the system's man pages.
Nowadays we offer `exec -h` as intuitive way to show the documentation for
the fish-specific command (note that `help` is not a good replacement because
it uses a web browser).

Looking through the contended commands, it seems like for most of them,
the fish version is not substantially different from the system version.
A notable exception is `read` but I don't think it's a very important one.

So I think we should can sacrifice a bit of the native fish-scripting
experience in exchange for playing nicer with other shells. I think the
latter is more important because scripting is not our focus, the way I see it.
So maybe put our manpath at the end.

In lieu of that, let's at least have `exec.rst` reference the system variant.

[Linux man-pages]: https://www.kernel.org/doc/man-pages/

Closes #10376
  • Loading branch information
krobelus committed Apr 20, 2024
1 parent af5afe2 commit 414d9a1
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 10 deletions.
5 changes: 5 additions & 0 deletions doc_src/cmds/alias.rst
Expand Up @@ -16,6 +16,11 @@ Synopsis
Description
-----------

.. only:: builder_man

NOTE: This page documents the fish builtin ``alias``.
To see the documentation on any non-fish versions, use ``command man alias``.

``alias`` is a simple wrapper for the ``function`` builtin, which creates a function wrapping a command. It has similar syntax to POSIX shell ``alias``. For other uses, it is recommended to define a :doc:`function <function>`.

If you want to ease your interactive use, to save typing, consider using an :doc:`abbreviation <abbr>` instead.
Expand Down
6 changes: 6 additions & 0 deletions doc_src/cmds/cd.rst
Expand Up @@ -12,6 +12,12 @@ Synopsis

Description
-----------

.. only:: builder_man

NOTE: This page documents the fish builtin ``cd``.
To see the documentation on any non-fish versions, use ``command man cd``.

``cd`` changes the current working directory.

If *DIRECTORY* is given, it will become the new directory. If no parameter is given, the :envvar:`HOME` environment variable will be used.
Expand Down
5 changes: 5 additions & 0 deletions doc_src/cmds/command.rst
Expand Up @@ -13,6 +13,11 @@ Synopsis
Description
-----------

.. only:: builder_man

NOTE: This page documents the fish builtin ``command``.
To see the documentation on any non-fish versions, use ``command man command``.

**command** forces the shell to execute the program *COMMANDNAME* and ignore any functions or builtins with the same name.

In ``command foo``, ``command`` is a keyword.
Expand Down
5 changes: 5 additions & 0 deletions doc_src/cmds/echo.rst
Expand Up @@ -13,6 +13,11 @@ Synopsis
Description
-----------

.. only:: builder_man

NOTE: This page documents the fish builtin ``echo``.
To see the documentation on any non-fish versions, use ``command man echo``.

``echo`` displays *STRING* of text.

The following options are available:
Expand Down
5 changes: 5 additions & 0 deletions doc_src/cmds/exec.rst
Expand Up @@ -13,6 +13,11 @@ Synopsis
Description
-----------

.. only:: builder_man

NOTE: This page documents the fish builtin ``exec``.
To see the documentation on any non-fish versions, use ``command man exec``.

``exec`` replaces the currently running shell with a new command. On successful completion, ``exec`` never returns. ``exec`` cannot be used inside a pipeline.

The **--help** or **-h** option displays help about using this command.
Expand Down
5 changes: 5 additions & 0 deletions doc_src/cmds/jobs.rst
Expand Up @@ -14,6 +14,11 @@ Synopsis
Description
-----------

.. only:: builder_man

NOTE: This page documents the fish builtin ``jobs``.
To see the documentation on any non-fish versions, use ``command man jobs``.

``jobs`` prints a list of the currently running :ref:`jobs <syntax-job-control>` and their status.

``jobs`` accepts the following options:
Expand Down
3 changes: 1 addition & 2 deletions doc_src/cmds/printf.rst
Expand Up @@ -16,8 +16,7 @@ Description
.. only:: builder_man

NOTE: This page documents the fish builtin ``printf``.
To see the documentation on the ``printf`` command you might have,
use ``command man printf``.
To see the documentation on any non-fish versions, use ``command man printf``.

``printf`` uses the format string *FORMAT* to print the *ARGUMENT* arguments. This means that it takes format specifiers in the format string and replaces each with an argument.

Expand Down
3 changes: 1 addition & 2 deletions doc_src/cmds/pwd.rst
Expand Up @@ -18,8 +18,7 @@ Description
.. only:: builder_man

NOTE: This page documents the fish builtin ``pwd``.
To see the documentation on the ``pwd`` command you might have,
use ``command man pwd``.
To see the documentation on any non-fish versions, use ``command man pwd``.

``pwd`` outputs (prints) the current working directory.

Expand Down
5 changes: 5 additions & 0 deletions doc_src/cmds/read.rst
Expand Up @@ -13,6 +13,11 @@ Synopsis
Description
-----------

.. only:: builder_man

NOTE: This page documents the fish builtin ``read``.
To see the documentation on any non-fish versions, use ``command man read``.

``read`` reads from standard input and stores the result in shell variables. In an alternative mode, it can also print to its own standard output, for example for use in command substitutions.

By default, ``read`` reads a single line and splits it into variables on spaces or tabs. Alternatively, a null character or a maximum number of characters can be used to terminate the input, and other delimiters can be given.
Expand Down
3 changes: 1 addition & 2 deletions doc_src/cmds/realpath.rst
Expand Up @@ -17,8 +17,7 @@ Description
.. only:: builder_man

NOTE: This page documents the fish builtin ``realpath``.
To see the documentation on the ``realpath`` command you might have,
use ``command man realpath``.
To see the documentation on any non-fish versions, use ``command man realpath``.

:program:`realpath` follows all symbolic links encountered for the provided :envvar:`PATH`, printing the absolute path resolved. :doc:`fish <fish>` provides a :command:`realpath`-alike builtin intended to enrich systems where no such command is installed by default.

Expand Down
3 changes: 1 addition & 2 deletions doc_src/cmds/test.rst
Expand Up @@ -17,8 +17,7 @@ Description
.. only:: builder_man

NOTE: This page documents the fish builtin ``test``.
To see the documentation on the ``test`` command you might have,
use ``command man test``.
To see the documentation on any non-fish versions, use ``command man test``.

``test`` checks the given conditions and sets the exit status to 0 if they are true, 1 if they are false.

Expand Down
3 changes: 1 addition & 2 deletions doc_src/cmds/time.rst
Expand Up @@ -16,8 +16,7 @@ Description
.. only:: builder_man

NOTE: This page documents the fish keyword ``time``.
To see the documentation on the ``time`` command you might have,
use ``command man time``.
To see the documentation on any non-fish versions, use ``command man time``.

``time`` causes fish to measure how long a command takes and print the results afterwards. The command can be a simple fish command or a block. The results can not currently be redirected.

Expand Down
5 changes: 5 additions & 0 deletions doc_src/cmds/trap.rst
Expand Up @@ -13,6 +13,11 @@ Synopsis
Description
-----------

.. only:: builder_man

NOTE: This page documents the fish builtin ``trap``.
To see the documentation on any non-fish versions, use ``command man trap``.

``trap`` is a wrapper around the fish event delivery framework. It exists for backwards compatibility with POSIX shells. For other uses, it is recommended to define an :ref:`event handler <event>`.

The following parameters are available:
Expand Down
5 changes: 5 additions & 0 deletions doc_src/cmds/type.rst
Expand Up @@ -13,6 +13,11 @@ Synopsis
Description
-----------

.. only:: builder_man

NOTE: This page documents the fish builtin ``type``.
To see the documentation on any non-fish versions, use ``command man type``.

With no options, :command:`type` indicates how each *NAME* would be interpreted if used as a command name.

The following options are available:
Expand Down
5 changes: 5 additions & 0 deletions doc_src/cmds/umask.rst
Expand Up @@ -14,6 +14,11 @@ Synopsis
Description
-----------

.. only:: builder_man

NOTE: This page documents the fish builtin ``umask``.
To see the documentation on any non-fish versions, use ``command man umask``.

``umask`` displays and manipulates the "umask", or file creation mode mask, which is used to restrict the default access to files.

The umask may be expressed either as an octal number, which represents the rights that will be removed by default, or symbolically, which represents the only rights that will be granted by default.
Expand Down
5 changes: 5 additions & 0 deletions doc_src/cmds/wait.rst
Expand Up @@ -13,6 +13,11 @@ Synopsis
Description
-----------

.. only:: builder_man

NOTE: This page documents the fish builtin ``wait``.
To see the documentation on any non-fish versions, use ``command man wait``.

``wait`` waits for child jobs to complete.

If a *PID* is specified, the command waits for the job that the process with that process ID belongs to.
Expand Down

0 comments on commit 414d9a1

Please sign in to comment.