Debian Codegraph @

src/sudo/cli/mod.rs

raw symbols SCIP
1 #![forbid(unsafe_code)]
2
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#;
4 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/;
5 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#, ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#, memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/};
6
7 use craterust-analyzer cargo sudo-rs 0.2.14 crate/::commonrust-analyzer cargo sudo-rs 0.2.14 common/::{DisplayOsStrrust-analyzer cargo sudo-rs 0.2.14 common/DisplayOsStr#, SudoPathrust-analyzer cargo sudo-rs 0.2.14 common/path/SudoPath#, SudoStringrust-analyzer cargo sudo-rs 0.2.14 common/string/SudoString#};
8 use craterust-analyzer cargo sudo-rs 0.2.14 crate/::logrust-analyzer cargo sudo-rs 0.2.14 log/::user_warnrust-analyzer cargo sudo-rs 0.2.14 log/user_warn!;
9
10 pub mod helprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/help/;
11 pub mod help_editrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/help_edit/;
12
13 #[cfg(test)]
14 mod testsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/tests/;
15
16 pub enum SudoActionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction# {
17 Editrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#Edit#(SudoEditOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#),
18 Helprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#Help#(SudoHelpOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoHelpOptions#),
19 Listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#List#(SudoListOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#),
20 RemoveTimestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#RemoveTimestamp#(SudoRemoveTimestampOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRemoveTimestampOptions#),
21 ResetTimestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#ResetTimestamp#(SudoResetTimestampOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoResetTimestampOptions#),
22 Runrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#Run#(SudoRunOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#),
23 Validaterust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#Validate#(SudoValidateOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#),
24 Versionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#Version#(SudoVersionOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoVersionOptions#),
25 }
26
27 pub(superrust-analyzer cargo sudo-rs 0.2.14 sudo/) fn is_sudoeditrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/is_sudoedit().(command_path: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#>) -> bool {
28 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(&command_path.unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().())
29 .file_namerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]file_name().()
30 .is_some_andrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some_and().(|name| name.as_encoded_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]as_encoded_bytes().().starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]starts_with().(b"sudoedit"))
31 }
32
33 impl SudoActionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction# {
34 /// try to parse and environment variable assignment
35 /// parse command line arguments from the environment and handle errors
36 pub fn from_envrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoAction]from_env().() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoAction], Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
37 Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoAction]::try_parse_fromrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoAction]try_parse_from().(stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::args_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/args_os().())
38 }
39
40 pub fn try_parse_fromrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoAction]try_parse_from().<I, T>(iter: I) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoAction], Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>
41 where
42 I: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = T>,
43 T: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#> + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#,
44 {
45 let opts = SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#::try_parse_fromrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoOptions]try_parse_from().(iter)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
46 opts.validaterust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoOptions]validate().()
47 }
48 }
49
50 // sudo -h | -K | -k | -V
51 pub struct SudoHelpOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoHelpOptions# {}
52
53 impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#> for SudoHelpOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoHelpOptions# {
54 type Errorrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoHelpOptions][`TryFrom<SudoOptions>`]Error# = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
55
56 fn try_fromrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoHelpOptions][`TryFrom<SudoOptions>`]try_from().(mut opts: SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoHelpOptions][`TryFrom<SudoOptions>`], Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoHelpOptions][`TryFrom<SudoOptions>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> {
57 // see `SudoOptions::validate`
58 let help = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.helprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#help.);
59 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(help);
60
61 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoHelpOptions][`TryFrom<SudoOptions>`] {})
62 }
63 }
64
65 // sudo -h | -K | -k | -V
66 pub struct SudoVersionOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoVersionOptions# {}
67
68 impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#> for SudoVersionOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoVersionOptions# {
69 type Errorrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoVersionOptions][`TryFrom<SudoOptions>`]Error# = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
70
71 fn try_fromrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoVersionOptions][`TryFrom<SudoOptions>`]try_from().(mut opts: SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoVersionOptions][`TryFrom<SudoOptions>`], Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoVersionOptions][`TryFrom<SudoOptions>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> {
72 // see `SudoOptions::validate`
73 let version = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.versionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#version.);
74 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(version);
75
76 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoVersionOptions][`TryFrom<SudoOptions>`] {})
77 }
78 }
79
80 // sudo -h | -K | -k | -V
81 pub struct SudoRemoveTimestampOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRemoveTimestampOptions# {}
82
83 impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#> for SudoRemoveTimestampOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRemoveTimestampOptions# {
84 type Errorrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoRemoveTimestampOptions][`TryFrom<SudoOptions>`]Error# = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
85
86 fn try_fromrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoRemoveTimestampOptions][`TryFrom<SudoOptions>`]try_from().(mut opts: SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoRemoveTimestampOptions][`TryFrom<SudoOptions>`], Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoRemoveTimestampOptions][`TryFrom<SudoOptions>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> {
87 // see `SudoOptions::validate`
88 let remove_timestamp = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.remove_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#remove_timestamp.);
89 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(remove_timestamp);
90
91 reject_allrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/reject_all().("--remove-timestamp", opts)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
92
93 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoRemoveTimestampOptions][`TryFrom<SudoOptions>`] {})
94 }
95 }
96
97 // sudo -h | -K | -k | -V
98 pub struct SudoResetTimestampOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoResetTimestampOptions# {}
99
100 impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#> for SudoResetTimestampOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoResetTimestampOptions# {
101 type Errorrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoResetTimestampOptions][`TryFrom<SudoOptions>`]Error# = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
102
103 fn try_fromrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoResetTimestampOptions][`TryFrom<SudoOptions>`]try_from().(mut opts: SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoResetTimestampOptions][`TryFrom<SudoOptions>`], Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoResetTimestampOptions][`TryFrom<SudoOptions>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> {
104 // see `SudoOptions::validate`
105 let reset_timestamp = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#reset_timestamp.);
106 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(reset_timestamp);
107
108 reject_allrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/reject_all().("--reset-timestamp", opts)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
109
110 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoResetTimestampOptions][`TryFrom<SudoOptions>`] {})
111 }
112 }
113
114 // sudo -v [-ABkNnS] [-g group] [-h host] [-p prompt] [-u user]
115 pub struct SudoValidateOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions# {
116 // -A
117 pub askpassrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#askpass.: bool,
118 // -B
119 pub bellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#bell.: bool,
120 // -k
121 pub reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#reset_timestamp.: bool,
122 // -n
123 pub non_interactiverust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#non_interactive.: bool,
124 // -S
125 pub stdinrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#stdin.: bool,
126 // -p
127 pub promptrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#prompt.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
128 // -g
129 pub grouprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#group.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SudoStringrust-analyzer cargo sudo-rs 0.2.14 common/string/SudoString#>,
130 // -u
131 pub userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#user.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SudoStringrust-analyzer cargo sudo-rs 0.2.14 common/string/SudoString#>,
132 }
133
134 impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#> for SudoValidateOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions# {
135 type Errorrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoValidateOptions][`TryFrom<SudoOptions>`]Error# = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
136
137 fn try_fromrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoValidateOptions][`TryFrom<SudoOptions>`]try_from().(mut opts: SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoValidateOptions][`TryFrom<SudoOptions>`], Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoValidateOptions][`TryFrom<SudoOptions>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> {
138 // see `SudoOptions::validate`
139 let validate = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.validaterust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#validate.);
140 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(validate);
141
142 let askpass = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.askpassrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#askpass.);
143 let bell = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.bellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#bell.);
144 let reset_timestamp = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#reset_timestamp.);
145 let non_interactive = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.non_interactiverust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#non_interactive.);
146 let stdin = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.stdinrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#stdin.);
147 let prompt = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.promptrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#prompt.);
148 let group = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.grouprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#group.);
149 let user = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#user.);
150
151 if bell && stdin {
152 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!(
153 "{context} cannot be used together with {option}",
154 context = "--bell",
155 option = "--stdin"
156 ));
157 }
158
159 reject_allrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/reject_all().("--validate", opts)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
160
161 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoValidateOptions][`TryFrom<SudoOptions>`] {
162 askpassrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#askpass.,
163 bellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#bell.,
164 reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#reset_timestamp.,
165 non_interactiverust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#non_interactive.,
166 stdinrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#stdin.,
167 promptrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#prompt.,
168 grouprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#group.,
169 userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoValidateOptions#user.,
170 })
171 }
172 }
173
174 // sudo -e [-ABkNnS] [-r role] [-t type] [-C num] [-D directory] [-g group] [-h host] [-p prompt] [-R directory] [-T timeout] [-u user] file ...
175 pub struct SudoEditOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions# {
176 // -A
177 pub askpassrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#askpass.: bool,
178 // -B
179 pub bellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#bell.: bool,
180 // -k
181 pub reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#reset_timestamp.: bool,
182 // -n
183 pub non_interactiverust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#non_interactive.: bool,
184 // -S
185 pub stdinrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#stdin.: bool,
186 // -p
187 pub promptrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#prompt.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
188 // -D
189 pub chdirrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#chdir.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SudoPathrust-analyzer cargo sudo-rs 0.2.14 common/path/SudoPath#>,
190 // -g
191 pub grouprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#group.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SudoStringrust-analyzer cargo sudo-rs 0.2.14 common/string/SudoString#>,
192 // -u
193 pub userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#user.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SudoStringrust-analyzer cargo sudo-rs 0.2.14 common/string/SudoString#>,
194 pub positional_argsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#positional_args.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#>,
195 }
196
197 impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#> for SudoEditOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions# {
198 type Errorrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoEditOptions][`TryFrom<SudoOptions>`]Error# = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
199
200 fn try_fromrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoEditOptions][`TryFrom<SudoOptions>`]try_from().(mut opts: SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoEditOptions][`TryFrom<SudoOptions>`], Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoEditOptions][`TryFrom<SudoOptions>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> {
201 // see `SudoOptions::validate`
202 let edit = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.editrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#edit.);
203 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(edit);
204
205 let askpass = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.askpassrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#askpass.);
206 let bell = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.bellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#bell.);
207 let reset_timestamp = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#reset_timestamp.);
208 let non_interactive = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.non_interactiverust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#non_interactive.);
209 let stdin = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.stdinrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#stdin.);
210 let prompt = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.promptrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#prompt.);
211 let chdir = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.chdirrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#chdir.);
212 let group = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.grouprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#group.);
213 let user = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#user.);
214 let positional_args = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.positional_argsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#positional_args.);
215
216 if bell && stdin {
217 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!(
218 "{context} cannot be used together with {option}",
219 context = "--bell",
220 option = "--stdin"
221 ));
222 }
223
224 reject_allrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/reject_all().("--edit", opts)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
225
226 if positional_args.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
227 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!("must specify at least one file path").intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
228 }
229
230 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoEditOptions][`TryFrom<SudoOptions>`] {
231 askpassrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#askpass.,
232 bellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#bell.,
233 reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#reset_timestamp.,
234 non_interactiverust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#non_interactive.,
235 stdinrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#stdin.,
236 promptrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#prompt.,
237 chdirrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#chdir.,
238 grouprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#group.,
239 userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#user.,
240 positional_argsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoEditOptions#positional_args.,
241 })
242 }
243 }
244
245 // sudo -l [-ABkNnS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command [arg ...]]
246 pub struct SudoListOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions# {
247 // -A
248 pub askpassrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#askpass.: bool,
249 // -B
250 pub bellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#bell.: bool,
251 // -l OR -l -l
252 pub listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#list.: Listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/List#,
253
254 // -k
255 pub reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#reset_timestamp.: bool,
256 // -n
257 pub non_interactiverust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#non_interactive.: bool,
258 // -S
259 pub stdinrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#stdin.: bool,
260 // -p
261 pub promptrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#prompt.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
262 // -g
263 pub grouprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#group.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SudoStringrust-analyzer cargo sudo-rs 0.2.14 common/string/SudoString#>,
264 // -U
265 pub other_userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#other_user.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SudoStringrust-analyzer cargo sudo-rs 0.2.14 common/string/SudoString#>,
266 // -u
267 pub userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#user.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SudoStringrust-analyzer cargo sudo-rs 0.2.14 common/string/SudoString#>,
268
269 pub positional_argsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#positional_args.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#>,
270 }
271
272 impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#> for SudoListOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions# {
273 type Errorrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoListOptions][`TryFrom<SudoOptions>`]Error# = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
274
275 fn try_fromrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoListOptions][`TryFrom<SudoOptions>`]try_from().(mut opts: SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoListOptions][`TryFrom<SudoOptions>`], Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoListOptions][`TryFrom<SudoOptions>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> {
276 let askpass = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.askpassrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#askpass.);
277 let bell = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.bellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#bell.);
278 let list = opts.listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#list..takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]take().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
279 let reset_timestamp = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#reset_timestamp.);
280 let non_interactive = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.non_interactiverust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#non_interactive.);
281 let stdin = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.stdinrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#stdin.);
282 let prompt = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.promptrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#prompt.);
283 let group = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.grouprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#group.);
284 let other_user = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.other_userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#other_user.);
285 let user = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#user.);
286 let positional_args = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.positional_argsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#positional_args.);
287
288 if bell && stdin {
289 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!(
290 "{context} cannot be used together with {option}",
291 context = "--bell",
292 option = "--stdin"
293 ));
294 }
295
296 // when present, `-u` must be accompanied by a command
297 let has_command = !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().positional_args.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().();
298 let valid_user_flag = user.is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() || has_command;
299
300 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().valid_user_flag {
301 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!(
302 "'{option}' flag must be accompanied by a command",
303 option = "--user"
304 ));
305 }
306
307 reject_allrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/reject_all().("--list", opts)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
308
309 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoListOptions][`TryFrom<SudoOptions>`] {
310 askpassrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#askpass.,
311 bellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#bell.,
312 listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#list.,
313 reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#reset_timestamp.,
314 non_interactiverust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#non_interactive.,
315 stdinrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#stdin.,
316 promptrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#prompt.,
317 grouprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#group.,
318 other_userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#other_user.,
319 userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#user.,
320 positional_argsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoListOptions#positional_args.,
321 })
322 }
323 }
324
325 // sudo [-ABbEHnPS] [-C num] [-D directory] [-g group] [-h host] [-p prompt] [-R directory] [-T timeout] [-u user] [VAR=value] [-i | -s] [command [arg ...]]
326 pub struct SudoRunOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions# {
327 // -A
328 pub askpassrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#askpass.: bool,
329 // -B
330 pub bellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#bell.: bool,
331 // -b
332 pub backgroundrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#background.: bool,
333 // -E
334 /* ignored, part of env_var_list */
335 // -k
336 pub reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#reset_timestamp.: bool,
337 // -n
338 pub non_interactiverust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#non_interactive.: bool,
339 // -S
340 pub stdinrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#stdin.: bool,
341 // -p
342 pub promptrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#prompt.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
343 // -D
344 pub chdirrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#chdir.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SudoPathrust-analyzer cargo sudo-rs 0.2.14 common/path/SudoPath#>,
345 // -g
346 pub grouprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#group.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SudoStringrust-analyzer cargo sudo-rs 0.2.14 common/string/SudoString#>,
347 // -u
348 pub userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#user.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SudoStringrust-analyzer cargo sudo-rs 0.2.14 common/string/SudoString#>,
349 // VAR=value
350 pub env_var_listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#env_var_list.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#)>,
351 // -i
352 pub loginrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#login.: bool,
353 // -s
354 pub shellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#shell.: bool,
355 pub positional_argsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#positional_args.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#>,
356 }
357
358 impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#> for SudoRunOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions# {
359 type Errorrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoRunOptions][`TryFrom<SudoOptions>`]Error# = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
360
361 fn try_fromrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoRunOptions][`TryFrom<SudoOptions>`]try_from().(mut opts: SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoRunOptions][`TryFrom<SudoOptions>`], Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoRunOptions][`TryFrom<SudoOptions>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> {
362 let askpass = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.askpassrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#askpass.);
363 let bell = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.bellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#bell.);
364 let background = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.backgroundrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#background.);
365 let reset_timestamp = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#reset_timestamp.);
366 let non_interactive = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.non_interactiverust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#non_interactive.);
367 let stdin = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.stdinrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#stdin.);
368 let prompt = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.promptrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#prompt.);
369 let chdir = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.chdirrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#chdir.);
370 let group = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.grouprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#group.);
371 let user = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#user.);
372 let env_var_list = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.env_var_listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#env_var_list.);
373 let login = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.loginrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#login.);
374 let shell = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.shellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#shell.);
375 let positional_args = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut opts.positional_argsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#positional_args.);
376
377 if bell && stdin {
378 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!(
379 "{context} cannot be used together with {option}",
380 context = "--bell",
381 option = "--stdin"
382 ));
383 }
384
385 let context = match (login, shell, positional_args.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().()) {
386 (true, false, _) => "--login",
387 (false, true, _) => "--shell",
388 (false, false, false) => xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!("command (positional argument)"),
389
390 (true, true, _) => {
391 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!(
392 "{context} cannot be used together with {option}",
393 context = "--login",
394 option = "--shell"
395 ));
396 }
397 (false, false, true) => {
398 if cfgrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/cfg!!(debug_assertions) {
399 // see `SudoOptions::validate`
400 panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!();
401 } else {
402 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!(
403 "expected one of: --login, --shell, a command as a positional argument"
404 )
405 .intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
406 }
407 }
408 };
409
410 reject_allrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/reject_all().(context, opts)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
411
412 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoRunOptions][`TryFrom<SudoOptions>`] {
413 askpassrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#askpass.,
414 bellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#bell.,
415 backgroundrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#background.,
416 reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#reset_timestamp.,
417 non_interactiverust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#non_interactive.,
418 stdinrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#stdin.,
419 promptrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#prompt.,
420 chdirrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#chdir.,
421 grouprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#group.,
422 userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#user.,
423 env_var_listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#env_var_list.,
424 loginrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#login.,
425 shellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#shell.,
426 positional_argsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoRunOptions#positional_args.,
427 })
428 }
429 }
430
431 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)]
432 struct SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions# {
433 // -A
434 askpassrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#askpass.: bool,
435 // -B
436 bellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#bell.: bool,
437 // -b
438 backgroundrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#background.: bool,
439 // -D
440 chdirrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#chdir.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SudoPathrust-analyzer cargo sudo-rs 0.2.14 common/path/SudoPath#>,
441 // -g
442 grouprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#group.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SudoStringrust-analyzer cargo sudo-rs 0.2.14 common/string/SudoString#>,
443 // -i
444 loginrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#login.: bool,
445 // -n
446 non_interactiverust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#non_interactive.: bool,
447 // -U
448 other_userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#other_user.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SudoStringrust-analyzer cargo sudo-rs 0.2.14 common/string/SudoString#>,
449 // -E
450 /* ignored, part of env_var_list */
451 // -s
452 shellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#shell.: bool,
453 // -S
454 stdinrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#stdin.: bool,
455 // -p
456 promptrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#prompt.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
457 // -u
458 userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#user.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SudoStringrust-analyzer cargo sudo-rs 0.2.14 common/string/SudoString#>,
459
460 // additional environment
461 env_var_listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#env_var_list.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#)>,
462
463 /* actions */
464 // -e
465 editrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#edit.: bool,
466 // -h
467 helprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#help.: bool,
468 // -l
469 listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#list.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/List#>,
470 // -K
471 remove_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#remove_timestamp.: bool,
472 // -k
473 reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#reset_timestamp.: bool,
474 // -v
475 validaterust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#validate.: bool,
476 // -V
477 versionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#version.: bool,
478
479 // arguments passed straight through, either separated by -- or just trailing.
480 positional_argsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#positional_args.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#>,
481 }
482
483 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
484 pub enum Listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/List# {
485 Oncerust-analyzer cargo sudo-rs 0.2.14 sudo/cli/List#Once#,
486 Verboserust-analyzer cargo sudo-rs 0.2.14 sudo/cli/List#Verbose#,
487 }
488
489 impl Listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/List# {
490 #[must_use]
491 pub fn is_verboserust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[List]is_verbose().(&self) -> bool {
492 matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(self, Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[List]::Verboserust-analyzer cargo sudo-rs 0.2.14 sudo/cli/List#Verbose#)
493 }
494 }
495
496 enum SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg# {
497 Flagrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Flag#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#),
498 Argumentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Argument#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#),
499 Environmentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Environment#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#),
500 Restrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Rest#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#>),
501 }
502
503 fn demand_utf8rust-analyzer cargo sudo-rs 0.2.14 sudo/cli/demand_utf8().(arg: &OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
504 xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!(
505 "argument '{arg}' is not valid UTF-8",
506 arg = DisplayOsStrrust-analyzer cargo sudo-rs 0.2.14 common/DisplayOsStr#(arg)
507 )
508 }
509
510 impl SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg# {
511 const TAKES_ARGUMENT_SHORTrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoArg]TAKES_ARGUMENT_SHORT.: &'static [char] = &['D', 'g', 'h', 'p', 'R', 'U', 'u'];
512 const TAKES_ARGUMENTrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoArg]TAKES_ARGUMENT.: &'static [&'static str] = &[
513 "chdir",
514 "group",
515 "host",
516 "chroot",
517 "other-user",
518 "user",
519 "prompt",
520 ];
521
522 /// argument assignments and shorthand options preprocessing
523 /// the iterator should only iterate over the actual arguments
524 fn normalize_argumentsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoArg]normalize_arguments().<I>(mut arg_iter: I) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoArg]>, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>
525 where
526 I: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#>,
527 {
528 let mut processed = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![];
529
530 while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(arg) = arg_iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().() {
531 if arg rust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString][`PartialEq<&str>`]eq().==rust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString][`PartialEq<&str>`]eq(). rust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString][`PartialEq<&str>`]eq()."--" {
532 processed.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#::Restrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Rest#(arg_iter.collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()));
533 break;
534 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(unprefixed) = arg.as_encoded_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]as_encoded_bytes().().strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]strip_prefix().(b"--") {
535 let unprefixed = strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(unprefixed).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| demand_utf8rust-analyzer cargo sudo-rs 0.2.14 sudo/cli/demand_utf8().(&arg))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
536
537 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((key, value)) = unprefixed.split_oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_once().('=') {
538 // convert assignment to normal tokens
539
540 // only accept arguments when one is expected
541 // `--preserve-env` is special as it only takes an argument using this `key=value` syntax
542 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoArg]::TAKES_ARGUMENTrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoArg]TAKES_ARGUMENT..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&key) && key rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne()."preserve-env" {
543 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!(
544 "'{option}' does not take any arguments",
545 option = key
546 ))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
547 }
548 processed.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#::Argumentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Argument#("--".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().key, value.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()));
549 } else if Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoArg]::TAKES_ARGUMENTrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoArg]TAKES_ARGUMENT..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&unprefixed) {
550 let arg = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::from_utf8rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]from_utf8().(arg.into_encoded_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString]into_encoded_bytes().()).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("already checked");
551 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next) = arg_iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().() {
552 let next = strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(next.as_encoded_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]as_encoded_bytes().())
553 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| demand_utf8rust-analyzer cargo sudo-rs 0.2.14 sudo/cli/demand_utf8().(&next))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
554 processed.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#::Argumentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Argument#(arg, next.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()));
555 } else {
556 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!("'{option}' expects an argument", option = arg))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
557 }
558 } else {
559 let arg = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::from_utf8rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]from_utf8().(arg.into_encoded_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString]into_encoded_bytes().()).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("already checked");
560 processed.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#::Flagrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Flag#(arg));
561 }
562 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(unprefixed) = arg.as_encoded_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]as_encoded_bytes().().strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]strip_prefix().(b"-") {
563 let unprefixed = strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(unprefixed).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| demand_utf8rust-analyzer cargo sudo-rs 0.2.14 sudo/cli/demand_utf8().(&arg))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
564
565 // split combined shorthand options
566 let mut chars = unprefixed.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().();
567
568 while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(curr) = chars.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Chars<'a>`][Iterator]next().() {
569 let flag = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("-{curr}");
570 // convert option argument to separate segment
571 if Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoArg]::TAKES_ARGUMENT_SHORTrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoArg]TAKES_ARGUMENT_SHORT..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&curr) {
572 let rest = chars.as_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Chars<'a>`]as_str().();
573 let next = chars.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Chars<'a>`][Iterator]next().();
574
575 // assignment syntax is not accepted for shorthand arguments
576 if next rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('=') {
577 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!("invalid option '='"))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
578 }
579 if next.is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
580 processed.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#::Argumentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Argument#(flag, rest.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()));
581 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next) = arg_iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().() {
582 let next = strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(next.as_encoded_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]as_encoded_bytes().())
583 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| demand_utf8rust-analyzer cargo sudo-rs 0.2.14 sudo/cli/demand_utf8().(&next))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
584 processed.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#::Argumentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Argument#(flag, next.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()));
585 } else if curr rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'h' {
586 // short version of --help has no arguments
587 processed.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#::Flagrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Flag#(flag));
588 } else {
589 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!("'{option}' expects an argument", option = flag))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
590 }
591 break;
592 } else {
593 processed.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#::Flagrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Flag#(flag));
594 }
595 }
596 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((key, value)) = try_to_env_varrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/try_to_env_var().(&arg)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
597 processed.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#::Environmentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Environment#(key, value));
598 } else {
599 let mut rest = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![arg];
600 rest.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(arg_iter);
601 processed.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#::Restrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Rest#(rest));
602 break;
603 }
604 }
605
606 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(processed)
607 }
608 }
609
610 impl SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions# {
611 fn validaterust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoOptions]validate().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<SudoActionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
612 let action = if self.helprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#help. {
613 SudoActionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#::Helprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#Help#(self.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)
614 } else if self.versionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#version. {
615 SudoActionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#::Versionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#Version#(self.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)
616 } else if self.remove_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#remove_timestamp. {
617 SudoActionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#::RemoveTimestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#RemoveTimestamp#(self.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)
618 } else if self.validaterust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#validate. {
619 SudoActionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#::Validaterust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#Validate#(self.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)
620 } else if self.listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#list..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
621 SudoActionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#::Listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#List#(self.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)
622 } else if self.editrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#edit. {
623 SudoActionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#::Editrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#Edit#(self.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)
624 } else {
625 let is_run = self.loginrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#login. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor().self.shellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#shell. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor().!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.positional_argsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#positional_args..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().();
626
627 if is_run {
628 SudoActionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#::Runrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#Run#(self.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)
629 } else if self.reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#reset_timestamp. {
630 SudoActionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#::ResetTimestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoAction#ResetTimestamp#(self.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)
631 } else {
632 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!("expected one of these actions: --help, --version, --remove-timestamp, --validate, --list, --edit, --login, --shell, a command as a positional argument, --reset-timestamp").intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
633 }
634 };
635
636 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(action)
637 }
638
639 /// parse an iterator over command line arguments
640 fn try_parse_fromrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoOptions]try_parse_from().<I, T>(iter: I) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoOptions], Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>
641 where
642 I: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = T>,
643 T: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#> + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#,
644 {
645 let mut arg_iter = iter.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#::intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().);
646
647 let invoked_as_sudoedit = is_sudoeditrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/is_sudoedit().(arg_iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/map/impl#[`Map<I, F>`][Iterator]next().());
648
649 let mut options = Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoOptions] {
650 editrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#edit.: invoked_as_sudoedit,
651 ..Selfrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoOptions]::defaultrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoOptions][Default]default().()
652 };
653
654 let arg_iter = SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#::normalize_argumentsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[SudoArg]normalize_arguments().(arg_iter)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
655 .into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().()
656 .peekablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#peekable().();
657
658 for arg in arg_iter {
659 match arg {
660 SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#::Flagrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Flag#(flag) => match flag.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().() {
661 "-A" | "--askpass" => {
662 options.askpassrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#askpass. = true;
663 }
664 "-B" | "--bell" => {
665 options.bellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#bell. = true;
666 }
667 "-b" | "--background" => {
668 options.backgroundrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#background. = true;
669 }
670 "-E" | "--preserve-env" => {
671 user_warnrust-analyzer cargo sudo-rs 0.2.14 log/user_warn!!(
672 "preserving the entire environment is not supported, '{flag}' is ignored",
673 flag = flag
674 )
675 }
676 "-e" | "--edit" if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().invoked_as_sudoedit => {
677 options.editrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#edit. = true;
678 }
679 "-H" | "--set-home" => {
680 // this option is ignored, since it is the default for sudo-rs; but accept
681 // it for backwards compatibility reasons
682 }
683 "-h" | "--help" => {
684 options.helprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#help. = true;
685 }
686 "-i" | "--login" => {
687 options.loginrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#login. = true;
688 }
689 "-K" | "--remove-timestamp" => {
690 options.remove_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#remove_timestamp. = true;
691 }
692 "-k" | "--reset-timestamp" => {
693 options.reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#reset_timestamp. = true;
694 }
695 "-l" | "--list" => match options.listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#list. {
696 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => options.listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#list. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/List#::Oncerust-analyzer cargo sudo-rs 0.2.14 sudo/cli/List#Once#),
697 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/List#::Oncerust-analyzer cargo sudo-rs 0.2.14 sudo/cli/List#Once#) => options.listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#list. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/List#::Verboserust-analyzer cargo sudo-rs 0.2.14 sudo/cli/List#Verbose#),
698 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/List#::Verboserust-analyzer cargo sudo-rs 0.2.14 sudo/cli/List#Verbose#) => {}
699 },
700 "-n" | "--non-interactive" => {
701 options.non_interactiverust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#non_interactive. = true;
702 }
703 "-S" | "--stdin" => {
704 options.stdinrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#stdin. = true;
705 }
706 "-s" | "--shell" => {
707 options.shellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#shell. = true;
708 }
709 "-V" | "--version" => {
710 options.versionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#version. = true;
711 }
712 "-v" | "--validate" => {
713 options.validaterust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#validate. = true;
714 }
715 _option => {
716 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!("invalid option provided"))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
717 }
718 },
719 SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#::Argumentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Argument#(option, value) => match option.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().() {
720 "-D" | "--chdir" => {
721 options.chdirrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#chdir. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(SudoPathrust-analyzer cargo sudo-rs 0.2.14 common/path/SudoPath#::from_cli_stringrust-analyzer cargo sudo-rs 0.2.14 common/path/impl#[SudoPath]from_cli_string().(value));
722 }
723 "-E" | "--preserve-env" => {
724 options
725 .env_var_listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#env_var_list.
726 .extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(value.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().(',').filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|var| {
727 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::varrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/var().(var)
728 .okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()
729 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|value| (var.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), value))
730 }));
731 }
732 "-g" | "--group" => {
733 options.grouprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#group. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(SudoStringrust-analyzer cargo sudo-rs 0.2.14 common/string/SudoString#::from_cli_stringrust-analyzer cargo sudo-rs 0.2.14 common/string/impl#[SudoString]from_cli_string().(value));
734 }
735 "-p" | "--prompt" => {
736 options.promptrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#prompt. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value);
737 }
738 "-U" | "--other-user" => {
739 options.other_userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#other_user. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(SudoStringrust-analyzer cargo sudo-rs 0.2.14 common/string/SudoString#::from_cli_stringrust-analyzer cargo sudo-rs 0.2.14 common/string/impl#[SudoString]from_cli_string().(value));
740 }
741 "-u" | "--user" => {
742 options.userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#user. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(SudoStringrust-analyzer cargo sudo-rs 0.2.14 common/string/SudoString#::from_cli_stringrust-analyzer cargo sudo-rs 0.2.14 common/string/impl#[SudoString]from_cli_string().(value));
743 }
744 _option => {
745 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!("invalid option provided"))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
746 }
747 },
748 SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#::Environmentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Environment#(key, value) => {
749 options.env_var_listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#env_var_list..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((key, value));
750 }
751 SudoArgrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#::Restrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoArg#Rest#(mut rest) => {
752 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(cmd) = rest.firstrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]first().() {
753 let cmd = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(cmd);
754 // This checks if the last character in the path is a /. This
755 // works because the OS directly splits at b'/' without regards
756 // for if it is part of another character (which it can't be
757 // with UTF-8 anyways).
758 let is_dir = cmd.as_os_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]as_os_str().().as_encoded_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]as_encoded_bytes().().ends_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]ends_with().(b"/");
759 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().options.editrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#edit.
760 && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().is_dir
761 && (cmd.ends_withrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]ends_with().("sudoedit") || cmd.ends_withrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]ends_with().("sudoedit-rs"))
762 {
763 user_warnrust-analyzer cargo sudo-rs 0.2.14 log/user_warn!!("sudoedit doesn't need to be run via sudo");
764 options.editrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#edit. = true;
765 rest.removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]remove().(0);
766 }
767 }
768
769 options.positional_argsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#positional_args. = rest;
770 }
771 }
772 }
773
774 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(options)
775 }
776 }
777
778 fn try_to_env_varrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/try_to_env_var().(arg: &OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#)>, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
779 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().arg.as_encoded_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]as_encoded_bytes().().containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&b'=') {
780 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
781 }
782
783 let arg = strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(arg.as_encoded_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]as_encoded_bytes().()).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| demand_utf8rust-analyzer cargo sudo-rs 0.2.14 sudo/cli/demand_utf8().(arg))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
784
785 let (name, value) = arg
786 .split_oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_once().('=')
787 .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("checked above that an = is present");
788
789 if name.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(|c| c.is_alphanumericrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]is_alphanumeric().() || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'_') {
790 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((name.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), value.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())))
791 } else {
792 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)
793 }
794 }
795
796 trait IsAbsentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/IsAbsent# {
797 fn is_absentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/IsAbsent#is_absent().(&self) -> bool;
798 }
799
800 impl IsAbsentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/IsAbsent# for bool {
801 fn is_absentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[bool][IsAbsent]is_absent().(&self) -> bool {
802 !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self
803 }
804 }
805
806 impl<T> IsAbsentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/IsAbsent# for Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<T> {
807 fn is_absentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[`Option<T>`][IsAbsent]is_absent().(&self) -> bool {
808 self.is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().()
809 }
810 }
811
812 impl<T> IsAbsentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/IsAbsent# for Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T> {
813 fn is_absentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/impl#[`Vec<T>`][IsAbsent]is_absent().(&self) -> bool {
814 self.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().()
815 }
816 }
817
818 fn ensure_is_absentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/ensure_is_absent().(context: &str, thing: &dyn IsAbsentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/IsAbsent#, name: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
819 if thing.is_absentrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/IsAbsent#is_absent().() {
820 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
821 } else {
822 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!(
823 "{context} cannot be used together with {option}",
824 context = context,
825 option = name
826 ))
827 }
828 }
829
830 fn reject_allrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/reject_all().(context: &str, opts: SudoOptionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
831 macro_rules! check_optionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/check_options! {
832 ($($field:ident $(= $name:expr)?,)*) => {{
833 let SudoOptions { $($field),* } = opts;
834
835 $(
836 let name = check_options!(@name $field $($name)?);
837 ensure_is_absent(context, &$field, &name)?;
838 )*
839
840 Ok(())
841 }};
842 (@name $field:ident) => {{
843 let name = concat!("--", stringify!($field));
844 if name.contains('_') {
845 Cow::Owned(name.replace('_', "-"))
846 } else {
847 Cow::Borrowed(name)
848 }
849 }};
850 (@name $field:ident $name:expr) => {
851 $name
852 };
853 }
854
855 check_optionsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/check_options!!(
856 askpassrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#askpass.,
857 bellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#bell.,
858 backgroundrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#background.,
859 chdirrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#chdir.,
860 editrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#edit.,
861 grouprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#group.,
862 helprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#help.,
863 listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#list.,
864 loginrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#login.,
865 non_interactiverust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#non_interactive.,
866 other_userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#other_user.,
867 remove_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#remove_timestamp.,
868 reset_timestamprust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#reset_timestamp.,
869 shellrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#shell.,
870 stdinrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#stdin.,
871 promptrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#prompt.,
872 userrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#user.,
873 validaterust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#validate.,
874 versionrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#version.,
875 positional_argsrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#positional_args. = xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!("command"),
876 env_var_listrust-analyzer cargo sudo-rs 0.2.14 sudo/cli/SudoOptions#env_var_list. = xlatrust-analyzer cargo sudo-rs 0.2.14 gettext/xlat!!("environment variable"),
877 )
878 }