1- pub const USAGE_MSG : & str = "\
1+ pub fn usage_msg ( ) -> & ' static str {
2+ xlat ! (
3+ "\
24 usage: sudo -h | -K | -k | -V
35usage: sudo [-BknS] [-p prompt] [-D directory] [-g group] [-u user] [-i | -s] [command [arg ...]]
46usage: sudo -v [-BknS] [-p prompt] [-g group] [-u user]
57usage: sudo -l [-BknS] [-p prompt] [-U user] [-g group] [-u user] [command [arg ...]]
6- usage: sudo -e [-BknS] [-p prompt] [-D directory] [-g group] [-u user] file ..." ;
8+ usage: sudo -e [-BknS] [-p prompt] [-D directory] [-g group] [-u user] file ..."
9+ )
10+ }
711
8- const DESCRIPTOR : & str = "sudo - run commands as another user" ;
12+ fn descriptor ( ) -> & ' static str {
13+ xlat ! ( "sudo - run commands as another user" )
14+ }
915
10- const HELP_MSG : & str = "Options:
16+ fn help_msg ( ) -> & ' static str {
17+ xlat ! ( "Options:
1118 -B, --bell ring bell when prompting
1219 -D, --chdir=directory change the working directory before running command
1320 -g, --group=group run command as the specified group name or ID
@@ -24,8 +31,9 @@ const HELP_MSG: &str = "Options:
2431 -u, --user=user run command (or edit file) as specified user name or ID
2532 -V, --version display version information and exit
2633 -v, --validate update user's timestamp without running a command
27- -- stop processing command line arguments" ;
34+ -- stop processing command line arguments" )
35+ }
2836
2937pub fn long_help_message ( ) -> String {
30- format ! ( "{DESCRIPTOR }\n {USAGE_MSG }\n {HELP_MSG}" )
38+ format ! ( "{}\n {}\n {}" , descriptor ( ) , usage_msg ( ) , help_msg ( ) )
3139}
0 commit comments