docs/string: Separate "pad" and "shorten"

This isn't the same as "join"/"join0", where one is just a special
case of the other.

These are two different, if basically opposite commands.

But more importantly this was a huge mess and the formatting was broken.
This commit is contained in:
Fabian Boehm 2023-04-20 22:17:08 +02:00
parent 12ce42a2f9
commit 76b3965648
3 changed files with 30 additions and 7 deletions

View file

@ -48,13 +48,13 @@ Examples
>_ string pad -w$COLUMNS (date)
# Prints the current time on the right edge of the screen.
.. END EXAMPLES
See Also
--------
.. BEGIN SEEALSO
- The :doc:`printf <printf>` command can do simple padding, for example ``printf %10s\n`` works like ``string pad -w10``.
- :doc:`string length <string-length>` with the ``--visible`` option can be used to show what fish thinks the width is.
.. END EXAMPLES

View file

@ -81,13 +81,15 @@ Examples
# Taking 20 columns from the right instead:
…in-path-with-expand
.. END EXAMPLES
See Also
--------
.. BEGIN SEEALSO
- :ref:`string<cmd-string>`'s ``pad`` subcommand does the inverse of this command, adding padding to a specific width instead.
- The :doc:`printf <printf>` command can do simple padding, for example ``printf %10s\n`` works like ``string pad -w10``.
- :doc:`string length <string-length>` with the ``--visible`` option can be used to show what fish thinks the width is.
.. END EXAMPLES

View file

@ -154,8 +154,8 @@ Examples
:start-after: BEGIN EXAMPLES
:end-before: END EXAMPLES
"pad" and "shorten" subcommands
---------------------------------
"pad" subcommand
----------------
.. include:: string-pad.rst
:start-after: BEGIN SYNOPSIS
@ -165,10 +165,22 @@ Examples
:start-after: BEGIN DESCRIPTION
:end-before: END DESCRIPTION
Examples
^^^^^^^^
.. include:: string-pad.rst
:start-after: BEGIN EXAMPLES
:end-before: END EXAMPLES
See also
^^^^^^^^
.. include:: string-pad.rst
:start-after: BEGIN SEEALSO
"shorten" subcommand
--------------------
.. include:: string-shorten.rst
:start-after: BEGIN SYNOPSIS
:end-before: END SYNOPSIS
@ -177,10 +189,19 @@ Examples
:start-after: BEGIN DESCRIPTION
:end-before: END DESCRIPTION
Examples
^^^^^^^^
.. include:: string-shorten.rst
:start-after: BEGIN EXAMPLES
:end-before: END EXAMPLES
See also
^^^^^^^^
.. include:: string-shorten.rst
:start-after: BEGIN SEEALSO
"repeat" subcommand
-------------------