fish-shell/doc_src/cmds/string-pad.rst
Johannes Altmanninger 97db9d5c38 docs synopses: fix alignment of continuation lines
This corrects what looks like wrong alignment of some synopsis lines.
(I think the alignment is not a bad idea but it makes us do more
manual work, maybe we can automate that in future.  We still need to
figure out how to translate it to HTML.)

"man -l build/user_doc/man/man1/history.1" before:

	string match [-a | --all] [-e | --entire] [-i | --ignore-case]
	            [-r | --regex] [-n | --index] [-q | --quiet] [-v | --invert]
	            PATTERN [STRING…]

and after:

	string match [-a | --all] [-e | --entire] [-i | --ignore-case]
	             [-r | --regex] [-n | --index] [-q | --quiet] [-v | --invert]
	             PATTERN [STRING…]

Also make the lines align the same way in the RST source by carefully
choosing the position of the backslash. I'm not sure why we used
two backslashes per line. Use only one; this gives us no choice
of where to put it so both source and man page output are aligned.
Change tabs to spaces to make the alignment in the source work.
2022-01-16 14:05:47 +01:00

58 lines
1.7 KiB
ReStructuredText

string-pad - pad strings to a fixed width
=========================================
Synopsis
--------
.. BEGIN SYNOPSIS
``string`` pad [**-r** | **--right**] [(**-c** | **--char**) *CHAR*] [(**-w** | **--width**) *INTEGER*]
\ [*STRING* ...]
.. END SYNOPSIS
Description
-----------
.. BEGIN DESCRIPTION
``string pad`` extends each STRING to the given visible width by adding CHAR to the left. That means the width of all visible characters added together, excluding escape sequences and accounting for $fish_emoji_width and $fish_ambiguous_width. It is the amount of columns in a terminal the STRING occupies.
The escape sequences reflect what *fish* knows about, and how it computes its output. Your terminal might support more escapes, or not support escape sequences that fish knows about.
If ``-r`` or ``--right`` is given, add the padding after a string.
If ``-c`` or ``--char`` is given, pad with CHAR instead of whitespace.
The output is padded to the maximum width of all input strings. If ``-w`` or ``--width`` is given, use at least that.
.. END DESCRIPTION
Examples
--------
.. BEGIN EXAMPLES
::
>_ string pad -w 10 abc abcdef
abc
abcdef
>_ string pad --right --char=🐟 "fish are pretty" "rich. "
fish are pretty
rich. 🐟🐟🐟🐟
>_ string pad -w$COLUMNS (date)
# Prints the current time on the right edge of the screen.
See Also
--------
- The :ref:`printf <cmd-printf>` command can do simple padding, for example ``printf %10s\n`` works like ``string pad -w10``.
- :ref:`string length <cmd-string-length>` with the ``--visible`` option can be used to show what fish thinks the width is.
.. END EXAMPLES