New --bar-style option; replace "default" with "plain" or with a lookup against the selected default, as appropriate.
This commit is contained in:
@@ -308,6 +308,9 @@ void display_help(void)
|
||||
{ "-N", "--name", N_("NAME"),
|
||||
N_("prefix visual information with NAME"),
|
||||
{ 0, 0, 0, 0} },
|
||||
{ "-u", "--bar-style", N_("STYLE"),
|
||||
N_("set default bar style to NAME"),
|
||||
{ 0, 0, 0, 0} },
|
||||
{ "-x", "--extra-display", N_("SPEC"),
|
||||
N_("also send progress to SPEC"),
|
||||
{ 0, 0, 0, 0} },
|
||||
|
||||
@@ -502,6 +502,7 @@ int main(int argc, char **argv)
|
||||
pv_state_no_splice_set(state, opts->no_splice);
|
||||
pv_state_size_set(state, opts->size);
|
||||
pv_state_name_set(state, opts->name);
|
||||
pv_state_default_bar_style_set(state, opts->default_bar_style);
|
||||
pv_state_format_string_set(state, opts->format);
|
||||
pv_state_extra_display_set(state, opts->extra_display);
|
||||
pv_state_watch_pid_set(state, opts->watch_pid);
|
||||
|
||||
+10
-1
@@ -296,6 +296,7 @@ opts_t opts_parse(unsigned int argc, char **argv)
|
||||
{ "width", 1, NULL, (int) 'w' },
|
||||
{ "height", 1, NULL, (int) 'H' },
|
||||
{ "name", 1, NULL, (int) 'N' },
|
||||
{ "bar-style", 1, NULL, (int) 'u' },
|
||||
{ "format", 1, NULL, (int) 'F' },
|
||||
{ "extra-display", 1, NULL, (int) 'x' },
|
||||
{ "stats", 0, NULL, (int) 'v' },
|
||||
@@ -322,7 +323,7 @@ opts_t opts_parse(unsigned int argc, char **argv)
|
||||
/*@+nullassign@ */
|
||||
int option_index = 0;
|
||||
#endif /* HAVE_GETOPT_LONG */
|
||||
char *short_options = "hVpteIrab8kTA:fvnqcWD:s:gl0i:w:H:N:F:x:L:B:CEZ:SYKXU:R:P:d:m:o:"
|
||||
char *short_options = "hVpteIrab8kTA:fvnqcWD:s:gl0i:w:H:N:u:F:x:L:B:CEZ:SYKXU:R:P:d:m:o:"
|
||||
#ifdef ENABLE_DEBUGGING
|
||||
"!:"
|
||||
#endif
|
||||
@@ -595,6 +596,14 @@ opts_t opts_parse(unsigned int argc, char **argv)
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case 'u':
|
||||
opts->default_bar_style = pv_strdup(optarg);
|
||||
if (NULL == opts->default_bar_style) {
|
||||
fprintf(stderr, "%s: -u: %s\n", opts->program_name, strerror(errno));
|
||||
opts_free(opts);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case 'L':
|
||||
opts->rate_limit = pv_getnum_size(optarg, opts->decimal_units);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user