diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-08-19 04:28:22 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-08-19 04:28:22 +0200 |
commit | 21f31f23cc15c0957c1e0adec36f74ad8892c6ef (patch) | |
tree | 4f8755fac2e5d6ca8575bad99868cf5cba22aa7c | |
parent | networkctl: enable interactive authentication for dbus method call (diff) | |
download | systemd-21f31f23cc15c0957c1e0adec36f74ad8892c6ef.tar.xz systemd-21f31f23cc15c0957c1e0adec36f74ad8892c6ef.zip |
networkctl: introduce --no-ask-password option
-rw-r--r-- | man/networkctl.xml | 10 | ||||
-rw-r--r-- | shell-completion/bash/networkctl | 4 | ||||
-rw-r--r-- | shell-completion/zsh/_networkctl | 1 | ||||
-rw-r--r-- | src/network/networkctl.c | 33 |
4 files changed, 33 insertions, 15 deletions
diff --git a/man/networkctl.xml b/man/networkctl.xml index e47cf5895c..6cc6d0df1f 100644 --- a/man/networkctl.xml +++ b/man/networkctl.xml @@ -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> diff --git a/shell-completion/bash/networkctl b/shell-completion/bash/networkctl index 6c9daa7659..04f54e0e92 100644 --- a/shell-completion/bash/networkctl +++ b/shell-completion/bash/networkctl @@ -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' ) diff --git a/shell-completion/zsh/_networkctl b/shell-completion/zsh/_networkctl index ad5b91fb83..cf072c0fcb 100644 --- a/shell-completion/zsh/_networkctl +++ b/shell-completion/zsh/_networkctl @@ -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' \ diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 1d43bd2dee..854f73045f 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -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; |