docs: add short documentation for export

Work on #10541.
This commit is contained in:
David Adam 2024-11-06 23:47:31 +08:00
parent 767ae87191
commit 0d9ad0f23b
2 changed files with 44 additions and 0 deletions

43
doc_src/cmds/export.rst Normal file
View File

@ -0,0 +1,43 @@
.. _cmd-export:
export - compatibility function for exporting variables
=======================================================
Synopsis
--------
.. synopsis::
export
export NAME=VALUE
Description
-----------
``export`` is a function included for compatibility with POSIX shells. In general, the :doc:`set <set>`
builtin should be used instead.
When called without arguments, ``export`` prints a list of currently-exported variables, like ``set
-x``.
When called with a ``NAME=VALUE`` pair, the variable ``NAME`` is set to ``VALUE`` in the global
scope, and exported as an environment variable to other commands.
There are no options available.
Example
-------
The following commands have an identical effect.
::
set -gx PAGER bat
export PAGER=bat
See more
--------
1. The :doc:`set <set>` command.

View File

@ -79,6 +79,7 @@ Some helper functions, often to give you information for use in your prompt:
- :doc:`fish_add_path <cmds/fish_add_path>` to easily add a path to $PATH.
- :doc:`alias <cmds/alias>` to quickly define wrapper functions ("aliases").
- :doc:`fish_delta <cmds/fish_delta>` to show what you have changed from the default configuration.
- :doc:`export <cmds/export>` as a compatibility function for other shells.
Helper commands
^^^^^^^^^^^^^^^