1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

networkctl: introduce --no-ask-password option

This commit is contained in:
Yu Watanabe 2024-08-19 11:28:22 +09:00
parent 67899e3e6b
commit 21f31f23cc
4 changed files with 33 additions and 15 deletions

View File

@ -634,6 +634,16 @@ s - Service VLAN, m - Two-port MAC Relay (TPMR)
<xi:include href="standard-options.xml" xpointer="no-legend" />
<xi:include href="standard-options.xml" xpointer="no-pager" />
<varlistentry>
<term><option>--no-ask-password</option></term>
<listitem>
<para>Do not query the user for authentication for privileged operations.</para>
<xi:include href="version-info.xml" xpointer="v257"/>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -44,8 +44,8 @@ _networkctl() {
local i verb comps
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
local -A OPTS=(
[STANDALONE]='-a --all -h --help --version --no-pager --no-legend -s --stats -l --full
--no-reload --runtime'
[STANDALONE]='-a --all -h --help --version --no-pager --no-legend --no-ask-password
-s --stats -l --full --no-reload --runtime'
[ARG]='-n --lines --json --drop-in'
)

View File

@ -52,6 +52,7 @@ _arguments \
'(-a --all)'{-a,--all}'[Show all links with status]' \
'--no-pager[Do not pipe output into a pager]' \
'--no-legend[Do not print the column headers]' \
'--no-ask-password[Do not prompt for password]' \
'(- *)'{-h,--help}'[Show this help]' \
'(- *)--version[Show package version]' \
'--drop-in=[Use the given drop-in file name]:NAME' \

View File

@ -3027,6 +3027,7 @@ static int help(void) {
" --version Show package version\n"
" --no-pager Do not pipe output into a pager\n"
" --no-legend Do not show the headers and footers\n"
" --no-ask-password Do not prompt for password\n"
" -a --all Show status for all links\n"
" -s --stats Show detailed link statistics\n"
" -l --full Do not ellipsize output\n"
@ -3052,6 +3053,7 @@ static int parse_argv(int argc, char *argv[]) {
ARG_VERSION = 0x100,
ARG_NO_PAGER,
ARG_NO_LEGEND,
ARG_NO_ASK_PASSWORD,
ARG_JSON,
ARG_NO_RELOAD,
ARG_DROP_IN,
@ -3060,19 +3062,20 @@ static int parse_argv(int argc, char *argv[]) {
};
static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, ARG_VERSION },
{ "no-pager", no_argument, NULL, ARG_NO_PAGER },
{ "no-legend", no_argument, NULL, ARG_NO_LEGEND },
{ "all", no_argument, NULL, 'a' },
{ "stats", no_argument, NULL, 's' },
{ "full", no_argument, NULL, 'l' },
{ "lines", required_argument, NULL, 'n' },
{ "json", required_argument, NULL, ARG_JSON },
{ "no-reload", no_argument, NULL, ARG_NO_RELOAD },
{ "drop-in", required_argument, NULL, ARG_DROP_IN },
{ "runtime", no_argument, NULL, ARG_RUNTIME },
{ "stdin", no_argument, NULL, ARG_STDIN },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, ARG_VERSION },
{ "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 },
{ "all", no_argument, NULL, 'a' },
{ "stats", no_argument, NULL, 's' },
{ "full", no_argument, NULL, 'l' },
{ "lines", required_argument, NULL, 'n' },
{ "json", required_argument, NULL, ARG_JSON },
{ "no-reload", no_argument, NULL, ARG_NO_RELOAD },
{ "drop-in", required_argument, NULL, ARG_DROP_IN },
{ "runtime", no_argument, NULL, ARG_RUNTIME },
{ "stdin", no_argument, NULL, ARG_STDIN },
{}
};
@ -3103,6 +3106,10 @@ static int parse_argv(int argc, char *argv[]) {
arg_no_reload = true;
break;
case ARG_NO_ASK_PASSWORD:
arg_ask_password = false;
break;
case ARG_RUNTIME:
arg_runtime = true;
break;