From 837c446dc6875fe29fb9db0e3941f2365df8e1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20H=C3=B8rl=C3=BCck=20Berg?= <36937807+henrikhorluck@users.noreply.github.com> Date: Mon, 2 May 2022 17:19:37 +0200 Subject: [PATCH] Document `string split --fields` - The parameter-listing appears to have been lost as a part of https://github.com/fish-shell/fish-shell/commit/14d60ccb328fbff47408e914eb8cb27e887669b8 --- doc_src/cmds/string-split.rst | 13 +++++++------ doc_src/cmds/string.rst | 8 ++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/doc_src/cmds/string-split.rst b/doc_src/cmds/string-split.rst index 084742e5a..ea99afe06 100644 --- a/doc_src/cmds/string-split.rst +++ b/doc_src/cmds/string-split.rst @@ -8,10 +8,10 @@ Synopsis .. synopsis:: - string split [(-m | --max) MAX] [-n | --no-empty] [-q | --quiet] - [-r | --right] SEP [STRING ...] - string split0 [(-m | --max) MAX] [-n | --no-empty] [-q | --quiet] - [-r | --right] [STRING ...] + string split [-f | --fields] FIELDS [(-m | --max) MAX] [-n | --no-empty] + [-q | --quiet] [-r | --right] SEP [STRING ...] + string split0 [-f | --fields] FIELDS [(-m | --max) MAX] [-n | --no-empty] + [-q | --quiet] [-r | --right] [STRING ...] .. END SYNOPSIS @@ -22,7 +22,7 @@ Description ``string split`` splits each *STRING* on the separator *SEP*, which can be an empty string. If **-m** or **--max** is specified, at most MAX splits are done on each *STRING*. If **-r** or **--right** is given, splitting is performed right-to-left. This is useful in combination with **-m** or **--max**. With **-n** or **--no-empty**, empty results are excluded from consideration (e.g. ``hello\n\nworld`` would expand to two strings and not three). Exit status: 0 if at least one split was performed, or 1 otherwise. -Use **-f** or **--fields** to print out specific fields. Unless **--allow-empty** is used, if a given field does not exist, then the command exits with status 1 and does not print anything. +Use **-f** or **--fields** to print out specific fields. FIELDS is a comma-separated string of field numbers and/or spans. Each field is one-indexed, and will be printed on separate lines. If a given field does not exist, then the command exits with status 1 and does not print anything, unless **--allow-empty** is used. See also the **--delimiter** option of the :ref:`read ` command. @@ -53,9 +53,10 @@ Examples b c - >_ string split --allow-empty -f1,3,5 '' abc + >_ string split --allow-empty -f1,3-4,5 '' abcd a c + d NUL Delimited Examples diff --git a/doc_src/cmds/string.rst b/doc_src/cmds/string.rst index 49a54faf1..ca4c57821 100644 --- a/doc_src/cmds/string.rst +++ b/doc_src/cmds/string.rst @@ -23,10 +23,10 @@ Synopsis [-q | --quiet] [STRING ...] string replace [-a | --all] [-f | --filter] [-i | --ignore-case] [-r | --regex] [-q | --quiet] PATTERN REPLACE [STRING ...] - string split [(-m | --max) MAX] [-n | --no-empty] [-q | --quiet] - [-r | --right] SEP [STRING ...] - string split0 [(-m | --max) MAX] [-n | --no-empty] [-q | --quiet] - [-r | --right] [STRING ...] + string split [-f | --fields] FIELDS [(-m | --max) MAX] [-n | --no-empty] + [-q | --quiet] [-r | --right] SEP [STRING ...] + string split0 [-f | --fields] FIELDS [(-m | --max) MAX] [-n | --no-empty] + [-q | --quiet] [-r | --right] [STRING ...] string sub [(-s | --start) START] [(-l | --length) LENGTH] [-q | --quiet] [STRING ...] string trim [-l | --left] [-r | --right] [(-c | --chars) CHARS]