aboutsummaryrefslogtreecommitdiffhomepage
path: root/builtin.cpp
diff options
context:
space:
mode:
authorGravatar Kevin Ballard <kevin@sb.org>2014-09-21 21:09:21 -0700
committerGravatar Kevin Ballard <kevin@sb.org>2014-09-21 21:10:07 -0700
commitfe9cf673a23007d97d2cd6e2c96426d776c62aa6 (patch)
treee63aa851643cb0fd70f5eab1645ec7b0ca8a8b0a /builtin.cpp
parentb480c8ce79a581af47d49a6e2b71b08f9421427f (diff)
Add --right-prompt flag to read
Add a flag to read to allow for setting the right prompt command in addition to the existing support for setting the prompt command. Fixes #1698.
Diffstat (limited to 'builtin.cpp')
-rw-r--r--builtin.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/builtin.cpp b/builtin.cpp
index 1927b5ca..36be7e9b 100644
--- a/builtin.cpp
+++ b/builtin.cpp
@@ -2310,6 +2310,7 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
int i, argc = builtin_count_args(argv);
int place = ENV_USER;
const wchar_t *prompt = DEFAULT_READ_PROMPT;
+ const wchar_t *right_prompt = L"";
const wchar_t *commandline = L"";
int exit_res=STATUS_BUILTIN_OK;
const wchar_t *mode_name = READ_MODE_NAME;
@@ -2351,6 +2352,10 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
}
,
{
+ L"right-prompt", required_argument, 0, 'R'
+ }
+ ,
+ {
L"command", required_argument, 0, 'c'
}
,
@@ -2388,7 +2393,7 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
int opt = wgetopt_long(argc,
argv,
- L"xglUup:c:hm:n:saz",
+ L"xglUup:R:c:hm:n:saz",
long_options,
&opt_index);
if (opt == -1)
@@ -2431,6 +2436,10 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
prompt = woptarg;
break;
+ case L'R':
+ right_prompt = woptarg;
+ break;
+
case L'c':
commandline = woptarg;
break;
@@ -2556,6 +2565,7 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
reader_push(mode_name);
reader_set_left_prompt(prompt);
+ reader_set_right_prompt(right_prompt);
if (shell)
{
reader_set_complete_function(&complete);