From: Yu Watanabe Date: Fri, 2 Aug 2024 04:56:47 +0000 (+0900) Subject: localectl: introduce -l/--full option X-Git-Tag: v257-rc1~771 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40d90c9c01c8579a279f780e76f4edc2602d7926;p=thirdparty%2Fsystemd.git localectl: introduce -l/--full option Closes #33906. --- diff --git a/man/localectl.xml b/man/localectl.xml index e18462abab1..be0df8cc118 100644 --- a/man/localectl.xml +++ b/man/localectl.xml @@ -166,6 +166,17 @@ The following options are understood: + + + + + + Do not ellipsize the output. + + + + + diff --git a/shell-completion/bash/localectl b/shell-completion/bash/localectl index 1717842648b..4fd91d1a340 100644 --- a/shell-completion/bash/localectl +++ b/shell-completion/bash/localectl @@ -36,7 +36,7 @@ _localectl() { local i verb comps locale_vals local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='-h --help --version --no-convert --no-pager --no-ask-password - -H --host -M --machine' + -H --host -M --machine -l --full' if __contains_word "$prev" $OPTS; then case $prev in diff --git a/shell-completion/zsh/_localectl b/shell-completion/zsh/_localectl index 8c098413394..25040517138 100644 --- a/shell-completion/zsh/_localectl +++ b/shell-completion/zsh/_localectl @@ -95,4 +95,5 @@ _arguments \ '--no-ask-password[Do not prompt for password]' \ '(-H --host)'{-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \ '(-M --machine)'{-M+,--machine=}'[Operate on local container]:machine' \ + '(-l --full)'{-l,--full}'[Do not ellipsize the output]' \ '*::localectl commands:_localectl_commands' diff --git a/src/locale/localectl.c b/src/locale/localectl.c index 5b00820e5a5..45493597169 100644 --- a/src/locale/localectl.c +++ b/src/locale/localectl.c @@ -34,6 +34,7 @@ static bool arg_ask_password = true; static BusTransport arg_transport = BUS_TRANSPORT_LOCAL; static const char *arg_host = NULL; static bool arg_convert = true; +static bool arg_full = false; typedef struct StatusInfo { char **locale; @@ -76,6 +77,9 @@ static int print_status_info(StatusInfo *i) { if (!table) return log_oom(); + if (arg_full) + table_set_width(table, 0); + assert_se(cell = table_get_cell(table, 0, 0)); (void) table_set_ellipsize_percent(table, cell, 100); @@ -408,6 +412,7 @@ static int help(void) { "\nOptions:\n" " -h --help Show this help\n" " --version Show package version\n" + " -l --full Do not ellipsize output\n" " --no-pager Do not pipe output into a pager\n" " --no-ask-password Do not prompt for password\n" " -H --host=[USER@]HOST Operate on remote host\n" @@ -438,6 +443,7 @@ static int parse_argv(int argc, char *argv[]) { static const struct option options[] = { { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, ARG_VERSION }, + { "full", no_argument, NULL, 'l' }, { "no-pager", no_argument, NULL, ARG_NO_PAGER }, { "host", required_argument, NULL, 'H' }, { "machine", required_argument, NULL, 'M' }, @@ -451,7 +457,7 @@ static int parse_argv(int argc, char *argv[]) { assert(argc >= 0); assert(argv); - while ((c = getopt_long(argc, argv, "hH:M:", options, NULL)) >= 0) + while ((c = getopt_long(argc, argv, "hlH:M:", options, NULL)) >= 0) switch (c) { @@ -461,6 +467,10 @@ static int parse_argv(int argc, char *argv[]) { case ARG_VERSION: return version(); + case 'l': + arg_full = true; + break; + case ARG_NO_CONVERT: arg_convert = false; break;