Skip to content

Commit ee27f56

Browse files
authored
Add missing usage info (#1431)
2 parents 2f89a4f + 3f52ae1 commit ee27f56

File tree

6 files changed

+154
-116
lines changed

6 files changed

+154
-116
lines changed

.github/workflows/ci.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,19 @@ jobs:
436436
- name: Build docs
437437
run: cargo doc --no-deps --document-private-items
438438

439+
- name: Check CLI consistency
440+
run: |
441+
result=""
442+
documented_flags=$(grep -Eoe '"--?[A-Za-z][^"]*"' src/sudo/cli/mod.rs | tr -d '"' | sort -u | grep -v -e '-[EH]' -e '--set-home')
443+
for flag in $documented_flags; do
444+
for doc in src/sudo/cli/help.rs docs/man/sudo.8.md; do
445+
if ! grep -qFe "$flag" "$doc"; then
446+
result=failed; echo option "'$flag'" missing from "$doc"
447+
fi
448+
done
449+
done
450+
test -z "$result"
451+
439452
gettext:
440453
runs-on: ubuntu-latest
441454
steps:
@@ -446,7 +459,7 @@ jobs:
446459
sudo apt update
447460
sudo apt install gettext
448461
449-
- name: check translation consistency
462+
- name: Check translation consistency
450463
run: |
451464
result=""
452465
for file in po/*.po; do msgfmt --verbose --check "$file" || result=failed; done

docs/man/sudo.8.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ are introduced.
3939

4040
# OPTIONS
4141

42+
`-A`, `--askpass`
43+
: Normally, if sudo requires a password, it will read it from the user's terminal. If the -A (askpass) option is specified, a (possibly graphical)
44+
helper program is executed to read the user's password and output the password to the standard output. If the SUDO_ASKPASS environment variable is
45+
set, it specifies the path to the helper program. If no askpass program is available, sudo will exit with an error.
46+
4247
`-B`, `--bell`
4348
: Ring the bell as part of the password prompt when a terminal is present.
4449

@@ -115,9 +120,13 @@ are introduced.
115120
was specified, the shell from the user's password database entry will be
116121
used instead. If a *command* is specified, it is passed to the shell using the `-c` option.
117122

118-
`-e`, `sudoedit`
123+
`--preserve-env=list`
124+
: Indicates to the security policy that the user wishes to add the comma-separated list of environment variables to those preserved from the user's environment.
125+
The security policy may return an error if the user does not have permission to preserve the environment. This option may be specified multiple times.
126+
127+
`-e`, `--edit`, `sudoedit`
119128

120-
Edit one or more files instead of running a command. In lieu of a path name, the string "sudoedit" is used when consulting the security policy. If the user is authorized by the policy, the following steps are taken:
129+
: Edit one or more files instead of running a command. In lieu of a path name, the string "sudoedit" is used when consulting the security policy. If the user is authorized by the policy, the following steps are taken:
121130

122131
1. Temporary copies are made of the files to be edited with the owner set to the invoking user.
123132

po/nl.po

Lines changed: 53 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -15,84 +15,84 @@ msgstr ""
1515
"Content-Type: text/plain; charset=UTF-8\n"
1616
"Content-Transfer-Encoding: 8bit\n"
1717

18-
#: src/common/error.rs:55
18+
#: src/common/error.rs:51
1919
#, rust-format
2020
msgid "Sorry, user {user} is not allowed to execute '{command}' as {other_user} on {hostname}."
2121
msgstr "Sorry, gebruiker {user} mag '{command}' niet uitvoeren als {other_user} op {hostname}"
2222

23-
#: src/common/error.rs:64
23+
#: src/common/error.rs:60
2424
#, rust-format
2525
msgid "Sorry, user {user} may not run {command} on {hostname}."
2626
msgstr "Sorry, gebruiker {user} mag {command} niet uitvoeren op {hostname}."
2727

28-
#: src/common/error.rs:72
28+
#: src/common/error.rs:68
2929
msgid "sudo must be owned by uid 0 and have the setuid bit set"
3030
msgstr "sudo moet eigendom zijn van uid 0 en de setuid bit gezet hebben"
3131

32-
#: src/common/error.rs:75
32+
#: src/common/error.rs:71
3333
#, rust-format
3434
msgid "'{path}': command not found"
3535
msgstr "'{path}': opdracht niet gevonden"
3636

37-
#: src/common/error.rs:78
37+
#: src/common/error.rs:74
3838
#, rust-format
3939
msgid "'{path}': invalid command"
4040
msgstr "'{path}': ongeldige opdracht"
4141

42-
#: src/common/error.rs:80
42+
#: src/common/error.rs:76
4343
#, rust-format
4444
msgid "user '{user}' not found"
4545
msgstr "gebruiker '{user}' niet gevonden"
4646

47-
#: src/common/error.rs:81
47+
#: src/common/error.rs:77
4848
#, rust-format
4949
msgid "group '{group}' not found"
5050
msgstr "groep '{group}' niet gevonden"
5151

5252
#. TRANSLATORS: This is a well-known quote, try to preserve it in translation.
53-
#: src/common/error.rs:84
53+
#: src/common/error.rs:80
5454
#, rust-format
5555
msgid "I'm sorry {user}. I'm afraid I can't do that"
5656
msgstr "Het spijt me, {user}. Ik ben bang dat ik dat niet kan doen."
5757

58-
#: src/common/error.rs:86
58+
#: src/common/error.rs:82
5959
msgid "interactive authentication is required"
6060
msgstr "interactieve authenticatie is vereist"
6161

62-
#: src/common/error.rs:90
62+
#: src/common/error.rs:86
6363
msgid "you are not allowed to set the following environment variables:"
6464
msgstr "het is niet toegestaan de volgende omgevingsvariabelen te zetten:"
6565

66-
#: src/common/error.rs:106
66+
#: src/common/error.rs:102
6767
#, rust-format
6868
msgid "cannot execute '{path}': {error}"
6969
msgstr "kan '{path}' niet uitvoeren: {error}"
7070

71-
#: src/common/error.rs:111 src/pam/error.rs:226
71+
#: src/common/error.rs:107 src/pam/error.rs:226
7272
#, rust-format
7373
msgid "IO error: {error}"
7474
msgstr "Invoer/uitvoer-fout: {error}"
7575

76-
#: src/common/error.rs:117
76+
#: src/common/error.rs:113
7777
#, rust-format
7878
msgid "maximum {num} incorrect authentication attempts"
7979
msgstr "maximum van {num} authenticatiepogingen bereikt"
8080

81-
#: src/common/error.rs:123
81+
#: src/common/error.rs:119
8282
#, rust-format
8383
msgid "you are not allowed to use '--chdir {path}' with '{command}'"
8484
msgstr "het is niet toegestaan '--chdir {path}' te gebruiken met '{command}'"
8585

86-
#: src/common/error.rs:131 src/common/error.rs:138 src/pam/error.rs:211
86+
#: src/common/error.rs:127 src/common/error.rs:134 src/pam/error.rs:211
8787
msgid "Unexpected null character in input"
8888
msgstr "Onverwachte NUL-byte in input"
8989

90-
#: src/common/error.rs:145
90+
#: src/common/error.rs:141
9191
#, rust-format
9292
msgid "unable to change AppArmor profile to {profile}: {error}"
9393
msgstr "kan AppArmor profiel niet omzeten naar {profile}: {error}"
9494

95-
#: src/exec/mod.rs:141
95+
#: src/exec/mod.rs:154
9696
#, rust-format
9797
msgid "unable to change directory to {path}: {error}"
9898
msgstr "kan niet naar map {path} gaan: {error}"
@@ -172,29 +172,33 @@ msgstr "authenticatie"
172172
#: src/sudo/cli/help.rs:3
173173
msgid ""
174174
"usage: sudo -h | -K | -k | -V\n"
175-
"usage: sudo [-BknS] [-p prompt] [-D directory] [-g group] [-u user] [-i | -s] [command "
175+
"usage: sudo [-ABbknS] [-p prompt] [-D directory] [-g group] [-u user] [-i | -s] [command "
176176
"[arg ...]]\n"
177-
"usage: sudo -v [-BknS] [-p prompt] [-g group] [-u user]\n"
178-
"usage: sudo -l [-BknS] [-p prompt] [-U user] [-g group] [-u user] [command [arg ...]]\n"
179-
"usage: sudo -e [-BknS] [-p prompt] [-D directory] [-g group] [-u user] file ..."
177+
"usage: sudo -v [-ABknS] [-p prompt] [-g group] [-u user]\n"
178+
"usage: sudo -l [-ABknS] [-p prompt] [-U user] [-g group] [-u user] [command [arg ...]]\n"
179+
"usage: sudo -e [-ABknS] [-p prompt] [-D directory] [-g group] [-u user] file ..."
180180
msgstr ""
181181
"gebruik: sudo -h | -K | -k | -V\n"
182-
"gebruik: sudo [-BknS] [-p prompt] [-D map] [-g groep] [-u gebruiker] [-i | -s] [opdracht "
182+
"gebruik: sudo [-ABbknS] [-p prompt] [-D map] [-g groep] [-u gebruiker] [-i | -s] [opdracht "
183183
"[arg ...]]\n"
184-
"gebruik: sudo -v [-BknS] [-p prompt] [-g groep] [-u gebruiker]\n"
185-
"gebruik: sudo -l [-BknS] [-p prompt] [-U gebruiker] [-g groep] [-u gebruiker] [opdracht "
184+
"gebruik: sudo -v [-ABknS] [-p prompt] [-g groep] [-u gebruiker]\n"
185+
"gebruik: sudo -l [-ABknS] [-p prompt] [-U gebruiker] [-g groep] [-u gebruiker] [opdracht "
186186
"[arg ...]]\n"
187-
"gebruik: sudo -e [-BknS] [-p prompt] [-D map] [-g groep] [-u gebruiker] bestand ..."
187+
"gebruik: sudo -e [-ABknS] [-p prompt] [-D map] [-g groep] [-u gebruiker] bestand ..."
188188

189189
#: src/sudo/cli/help.rs:13
190190
msgid "sudo - run commands as another user"
191191
msgstr "sudo - voer opdrachten uit als een ander"
192192

193193
#: src/sudo/cli/help.rs:17
194+
#, fuzzy
194195
msgid ""
195196
"Options:\n"
197+
" -A, --askpass use a helper program for password prompting\n"
198+
" -b, --background run command in the background\n"
196199
" -B, --bell ring bell when prompting\n"
197200
" -D, --chdir=directory change the working directory before running command\n"
201+
" -e, --edit edit files instead of running a command\n"
198202
" -g, --group=group run command as the specified group name or ID\n"
199203
" -h, --help display help message and exit\n"
200204
" -i, --login run login shell as the target user; a command may also be "
@@ -211,11 +215,15 @@ msgid ""
211215
" -u, --user=user run command (or edit file) as specified user name or ID\n"
212216
" -V, --version display version information and exit\n"
213217
" -v, --validate update user's timestamp without running a command\n"
218+
" --preserve-env=list preserve specific environment variables\n"
214219
" -- stop processing command line arguments"
215220
msgstr ""
216221
"Opties:\n"
222+
" -A, --askpass vraag het wachtwoord via een hulpprogramma\n"
223+
" -b, --background voer de opdracht uit in de achtergrond\n"
217224
" -B, --bell geef audiosignaal voor een prompt\n"
218225
" -D, --chdir=directory wijzig de map voor uitvoering\n"
226+
" -e, --edit bewerk bestanden in plaats van een opdracht uit te voeren\n"
219227
" -g, --group=groep voer opdracht uit onder de bepaalde groep\n"
220228
" -h, --help geef dit bericht weer\n"
221229
" -i, --login open de login shell van de gebruiker\n"
@@ -231,6 +239,7 @@ msgstr ""
231239
" -u, --user=gebruiker voer de opdracht uit als deze gebruiker\n"
232240
" -V, --version geef versie-informatie weer\n"
233241
" -v, --validate hernieuw authenticatie zonder nieuwe opdracht\n"
242+
" --preserve-env=list bewaar de aangegeven omgevingsvariabelen\n"
234243
" -- stop met het verwerken van opties"
235244

236245
#: src/sudo/cli/help_edit.rs:3
@@ -272,69 +281,69 @@ msgstr ""
272281
" -V, --version geef versie-informatie weer\n"
273282
" -- stop met het verwerken van opties"
274283

275-
#: src/sudo/cli/mod.rs:210 src/sudo/cli/mod.rs:275 src/sudo/cli/mod.rs:347 src/sudo/cli/mod.rs:433
276-
#: src/sudo/cli/mod.rs:446 src/sudo/cli/mod.rs:846
284+
#: src/sudo/cli/mod.rs:152 src/sudo/cli/mod.rs:217 src/sudo/cli/mod.rs:289 src/sudo/cli/mod.rs:378
285+
#: src/sudo/cli/mod.rs:391 src/sudo/cli/mod.rs:797
277286
#, rust-format
278287
msgid "{context} cannot be used together with {option}"
279288
msgstr "{context} en {option} kunnen niet tegelijkertijd gebruikt worden"
280289

281-
#: src/sudo/cli/mod.rs:284
290+
#: src/sudo/cli/mod.rs:226
282291
msgid "must specify at least one file path"
283292
msgstr "verwacht tenminste één bestandsnaam"
284293

285-
#: src/sudo/cli/mod.rs:359
294+
#: src/sudo/cli/mod.rs:301
286295
#, rust-format
287296
msgid "'{option}' flag must be accompanied by a command"
288297
msgstr "'{option}' flag moet gevolgd worden door een opdracht"
289298

290-
#: src/sudo/cli/mod.rs:442
299+
#: src/sudo/cli/mod.rs:387
291300
msgid "command (positional argument)"
292301
msgstr "opdracht (als argument)"
293302

294-
#: src/sudo/cli/mod.rs:457
303+
#: src/sudo/cli/mod.rs:402
295304
msgid "expected one of: --login, --shell, a command as a positional argument"
296305
msgstr "verwacht één van de volgende: --login, --shell, een opdracht als argument"
297306

298-
#: src/sudo/cli/mod.rs:586
307+
#: src/sudo/cli/mod.rs:534
299308
#, rust-format
300309
msgid "'{option}' does not take any arguments"
301310
msgstr "'{option}' verwacht geen argumenten"
302311

303-
#: src/sudo/cli/mod.rs:595 src/sudo/cli/mod.rs:623
312+
#: src/sudo/cli/mod.rs:543 src/sudo/cli/mod.rs:571
304313
#, rust-format
305314
msgid "'{option}' expects an argument"
306315
msgstr "'{option}' verwacht een argument"
307316

308-
#: src/sudo/cli/mod.rs:613
317+
#: src/sudo/cli/mod.rs:561
309318
msgid "invalid option '='"
310319
msgstr "ongeldige optie '='"
311320

312-
#: src/sudo/cli/mod.rs:666
321+
#: src/sudo/cli/mod.rs:614
313322
msgid ""
314323
"expected one of these actions: --help, --version, --remove-timestamp, --validate, --list, --edit, "
315324
"--login, --shell, a command as a positional argument, --reset-timestamp"
316325
msgstr ""
317326
"gebruik een van deze acties: --help, --version, --remove-timestamp, --validate, --list, --edit, --"
318327
"login, --shell, een opdracht, --reset-timestamp"
319328

320-
#: src/sudo/cli/mod.rs:703
329+
#: src/sudo/cli/mod.rs:654
321330
#, rust-format
322331
msgid "preserving the entire environment is not supported, '{flag}' is ignored"
323332
msgstr "de hele omgeving bewaren wordt niet ondersteund, '{flag}' is genegeerd"
324333

325-
#: src/sudo/cli/mod.rs:747 src/sudo/cli/mod.rs:776
334+
#: src/sudo/cli/mod.rs:698 src/sudo/cli/mod.rs:727
326335
msgid "invalid option provided"
327336
msgstr "ongeldige optie"
328337

329-
#: src/sudo/cli/mod.rs:794
338+
#: src/sudo/cli/mod.rs:745
330339
msgid "sudoedit doesn't need to be run via sudo"
331340
msgstr "sudoedit hoeft niet via sudo aangeroepen te worden"
332341

333-
#: src/sudo/cli/mod.rs:897
342+
#: src/sudo/cli/mod.rs:849
334343
msgid "command"
335344
msgstr "opdracht"
336345

337-
#: src/sudo/cli/mod.rs:898
346+
#: src/sudo/cli/mod.rs:850
338347
msgid "environment variable"
339348
msgstr "omgevingsvariabele"
340349

@@ -455,22 +464,22 @@ msgstr "sudoersbestand niet gevonden op {path}"
455464
msgid "invalid configuration: {error}"
456465
msgstr "configuratiefout: {error}"
457466

458-
#: src/sudo/pipeline/edit.rs:38
467+
#: src/sudo/pipeline/edit.rs:36
459468
#, rust-format
460469
msgid "{path}: editing symbolic links is not permitted"
461470
msgstr "symbolische links in {path} zijn niet toegestaan"
462471

463-
#: src/sudo/pipeline/edit.rs:43
472+
#: src/sudo/pipeline/edit.rs:41
464473
#, rust-format
465474
msgid "error opening {path}: {error}"
466475
msgstr "kan {path} niet openen: {error}"
467476

468-
#: src/sudo/pipeline/edit.rs:47
477+
#: src/sudo/pipeline/edit.rs:45
469478
#, rust-format
470479
msgid "invalid path: {path}"
471480
msgstr "ongeldig pad: {path}"
472481

473-
#: src/sudo/pipeline/edit.rs:52
482+
#: src/sudo/pipeline/edit.rs:50
474483
msgid "please address the problems and try again"
475484
msgstr "los de problemen op en probeer opnieuw"
476485

0 commit comments

Comments
 (0)