run0: implement -v/--validate to renew temporary auth

This is meant to mirror sudo's -v/--validate options, which autohrize
the user without running a command.
This commit is contained in:
Ronan Pigott
2026-06-20 09:55:02 +01:00
committed by Luca Boccassi
parent 78b53d0132
commit 2a48d18f20
4 changed files with 40 additions and 1 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ _run0() {
--setenv --background
)
local OPTS="${opts_with_values[*]} -h --help -V --version --no-ask-password --slice-inherit --empower"
OPTS="$OPTS -k --reset-timestamp -K --remove-timestamp"
OPTS="$OPTS -k --reset-timestamp -K --remove-timestamp -v --validate"
local i
for (( i=1; i <= COMP_CWORD; i++ )); do
+1
View File
@@ -49,6 +49,7 @@ local -a args=(
'(--chdir -D -i --same-root-dir)'{--chdir=,-D+}'[Run within the specified working directory]:directory:_files -/'
'(-k --reset-timestamp)'{-k,--reset-timestamp}'[Revoke temporary authorization for this terminal]'
'(-K --remove-timestamp)'{-K,--remove-timestamp}'[Revoke temporary authorizations for this user session]'
'(-v --validate)'{-v,--validate}'[Request authorization from polkit]'
'(-i)'--via-shell"[Invoke command via target user's login shell]"
'(--via-shell --chdir -D --same-root-dir)'-i"[Shortcut for --via-shell --chdir='~']"
'*--setenv=[Set the specified environment variable in the session]:environment variable:_parameters -g "*export*" -S = -q'