systemd-mount: add --no-legend command line option

This commit is contained in:
Yu Watanabe 2020-01-09 14:49:11 +09:00
parent 6ae6ea55d8
commit a5279634c0
2 changed files with 11 additions and 0 deletions

View file

@ -96,6 +96,7 @@
</varlistentry>
<xi:include href="standard-options.xml" xpointer="no-pager"/>
<xi:include href="standard-options.xml" xpointer="no-legend" />
<xi:include href="standard-options.xml" xpointer="no-ask-password"/>
<varlistentry>

View file

@ -45,6 +45,7 @@ enum {
static bool arg_no_block = false;
static PagerFlags arg_pager_flags = 0;
static bool arg_legend = true;
static bool arg_ask_password = true;
static bool arg_quiet = false;
static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
@ -90,6 +91,7 @@ static int help(void) {
" --version Show package version\n"
" --no-block Do not wait until operation finished\n"
" --no-pager Do not pipe output into a pager\n"
" --no-legend Do not show the headers\n"
" --no-ask-password Do not prompt for password\n"
" -q --quiet Suppress information messages during runtime\n"
" --user Run as user unit\n"
@ -125,6 +127,7 @@ static int parse_argv(int argc, char *argv[]) {
ARG_VERSION = 0x100,
ARG_NO_BLOCK,
ARG_NO_PAGER,
ARG_NO_LEGEND,
ARG_NO_ASK_PASSWORD,
ARG_USER,
ARG_SYSTEM,
@ -146,6 +149,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "version", no_argument, NULL, ARG_VERSION },
{ "no-block", no_argument, NULL, ARG_NO_BLOCK },
{ "no-pager", no_argument, NULL, ARG_NO_PAGER },
{ "no-legend", no_argument, NULL, ARG_NO_LEGEND },
{ "no-ask-password", no_argument, NULL, ARG_NO_ASK_PASSWORD },
{ "quiet", no_argument, NULL, 'q' },
{ "user", no_argument, NULL, ARG_USER },
@ -196,6 +200,10 @@ static int parse_argv(int argc, char *argv[]) {
arg_pager_flags |= PAGER_DISABLE;
break;
case ARG_NO_LEGEND:
arg_legend = false;
break;
case ARG_NO_ASK_PASSWORD:
arg_ask_password = false;
break;
@ -1389,6 +1397,8 @@ static int list_devices(void) {
if (r < 0)
return log_error_errno(r, "Failed to set sort index: %m");
table_set_header(table, arg_legend);
FOREACH_DEVICE(e, d) {
for (c = 0; c < _COLUMN_MAX; c++) {
const char *x = NULL;