From 225b1204d6928b484335917af8fbfb0de20e6f90 Mon Sep 17 00:00:00 2001 From: David Adam Date: Thu, 22 Aug 2019 21:23:06 +0800 Subject: [PATCH] read: add --list as synonym for --array Work on #5846. --- sphinx_doc_src/cmds/read.rst | 2 +- src/builtin_read.cpp | 1 + tests/read.in | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sphinx_doc_src/cmds/read.rst b/sphinx_doc_src/cmds/read.rst index f1edeaf2d..16568c0ae 100644 --- a/sphinx_doc_src/cmds/read.rst +++ b/sphinx_doc_src/cmds/read.rst @@ -43,7 +43,7 @@ The following options are available: - ``-x`` or ``--export`` exports the variables to child processes. -- ``-a`` or ``--array`` stores the result as a list in a single variable. +- ``-a`` or ``--list`` stores the result as a list in a single variable. This option is also available as ``--array`` for backwards compatibility. - ``-z`` or ``--null`` marks the end of the line with the NUL character, instead of newline. This also disables interactive mode. diff --git a/src/builtin_read.cpp b/src/builtin_read.cpp index 12258a705..04a161b4b 100644 --- a/src/builtin_read.cpp +++ b/src/builtin_read.cpp @@ -62,6 +62,7 @@ static const struct woption long_options[] = {{L"array", no_argument, NULL, 'a'} {L"global", no_argument, NULL, 'g'}, {L"help", no_argument, NULL, 'h'}, {L"line", no_argument, NULL, 'L'}, + {L"list", no_argument, NULL, 'a'}, {L"local", no_argument, NULL, 'l'}, {L"nchars", required_argument, NULL, 'n'}, {L"null", no_argument, NULL, 'z'}, diff --git a/tests/read.in b/tests/read.in index 4c8ca3475..c75137da5 100644 --- a/tests/read.in +++ b/tests/read.in @@ -10,8 +10,8 @@ read logmsg Read with -a and anything other than exactly on var name is an error read -a -read -a v1 v2 -read -a v1 +read --array v1 v2 +read --list v1 logmsg Verify correct behavior of subcommands and splitting of input. begin