|
@@ -194,6 +194,8 @@ struct choose_options {
|
194
|
194
|
const char *menu;
|
195
|
195
|
/** Timeout */
|
196
|
196
|
unsigned int timeout;
|
|
197
|
+ /** Default selection */
|
|
198
|
+ const char *select;
|
197
|
199
|
/** Keep menu */
|
198
|
200
|
int keep;
|
199
|
201
|
};
|
|
@@ -202,6 +204,8 @@ struct choose_options {
|
202
|
204
|
static struct option_descriptor choose_opts[] = {
|
203
|
205
|
OPTION_DESC ( "menu", 'm', required_argument,
|
204
|
206
|
struct choose_options, menu, parse_string ),
|
|
207
|
+ OPTION_DESC ( "default", 'd', required_argument,
|
|
208
|
+ struct choose_options, select, parse_string ),
|
205
|
209
|
OPTION_DESC ( "timeout", 't', required_argument,
|
206
|
210
|
struct choose_options, timeout, parse_integer ),
|
207
|
211
|
OPTION_DESC ( "keep", 'k', no_argument,
|
|
@@ -211,8 +215,8 @@ static struct option_descriptor choose_opts[] = {
|
211
|
215
|
/** "choose" command descriptor */
|
212
|
216
|
static struct command_descriptor choose_cmd =
|
213
|
217
|
COMMAND_DESC ( struct choose_options, choose_opts, 1, 1,
|
214
|
|
- "[--menu <menu>] [--timeout <timeout>] [--keep] "
|
215
|
|
- "<setting>" );
|
|
218
|
+ "[--menu <menu>] [--default <label>] "
|
|
219
|
+ "[--timeout <timeout>] [--keep] <setting>" );
|
216
|
220
|
|
217
|
221
|
/**
|
218
|
222
|
* The "choose" command
|
|
@@ -240,7 +244,7 @@ static int choose_exec ( int argc, char **argv ) {
|
240
|
244
|
goto err_parse_menu;
|
241
|
245
|
|
242
|
246
|
/* Show menu */
|
243
|
|
- if ( ( rc = show_menu ( menu, opts.timeout, &item ) ) != 0 )
|
|
247
|
+ if ( ( rc = show_menu ( menu, opts.timeout, opts.select, &item ) ) != 0)
|
244
|
248
|
goto err_show_menu;
|
245
|
249
|
|
246
|
250
|
/* Store setting */
|