]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkctl: introduce --no-ask-password option
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 19 Aug 2024 02:28:22 +0000 (11:28 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 19 Aug 2024 02:28:22 +0000 (11:28 +0900)
man/networkctl.xml
shell-completion/bash/networkctl
shell-completion/zsh/_networkctl
src/network/networkctl.c

index e47cf5895cf8648f4492a1a6c493fc5e6138804d..6cc6d0df1ff1c168679638570348e7935d644d17 100644 (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>
 
index 6c9daa7659cde3ce06e6a72f318a16decc399e14..04f54e0e928635a05639ae9b7353407f7fd44dbc 100644 (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'
     )
 
index ad5b91fb838f1d2a0396cf10e99d5d37452d88b6..cf072c0fcbba68c4b3d309849f6e46295e500b9e 100644 (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' \
index 1d43bd2dee64b61373f01b2d3f18b647af5d04c9..854f73045f16df7916ac368c8d0059d97372dc4c 100644 (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;