|
8 | 8 | // |
9 | 9 |
|
10 | 10 | use clap::Parser; |
11 | | -use gettextrs::{bind_textdomain_codeset, setlocale, textdomain, LocaleCategory}; |
| 11 | +use gettextrs::{bind_textdomain_codeset, gettext, setlocale, textdomain, LocaleCategory}; |
12 | 12 | use libc::{ |
13 | 13 | getegid, getgid, getuid, regcomp, regex_t, regexec, setgid, setuid, REG_ICASE, REG_NOMATCH, |
14 | 14 | }; |
@@ -42,53 +42,83 @@ static NEED_QUIT: Mutex<bool> = Mutex::new(false); |
42 | 42 | #[derive(Parser)] |
43 | 43 | #[command(version, about = "more - display files on a page-by-page basis")] |
44 | 44 | struct Args { |
45 | | - // Enable interactive session test |
46 | | - #[arg(long = "test", help = "Enable interactive session test.")] |
47 | | - test: bool, |
48 | | - |
49 | 45 | /// Do not scroll, display text and clean line ends |
50 | | - #[arg(short = 'c', help = "Do not scroll, display text and clean line ends.")] |
| 46 | + #[arg( |
| 47 | + short = 'c', |
| 48 | + long = "print-over", |
| 49 | + help = gettext("Do not scroll, display text and clean line ends") |
| 50 | + )] |
51 | 51 | print_over: bool, |
52 | 52 |
|
53 | 53 | /// Exit on end-of-file |
54 | | - #[arg(short = 'e', help = "Exit on end-of-file.")] |
| 54 | + #[arg( |
| 55 | + short = 'e', |
| 56 | + long = "exit-on-eof", |
| 57 | + help = gettext("Exit on end-of-file") |
| 58 | + )] |
55 | 59 | exit_on_eof: bool, |
56 | 60 |
|
57 | 61 | /// Perform pattern matching in searches without regard to case |
58 | 62 | #[arg( |
59 | 63 | short = 'i', |
60 | | - help = "Perform pattern matching in searches without regard to case." |
| 64 | + long = "ignore-case", |
| 65 | + help = gettext("Perform pattern matching in searches without regard to case") |
61 | 66 | )] |
62 | 67 | case_insensitive: bool, |
63 | 68 |
|
64 | 69 | /// Execute the more command(s) in the command arguments in the order specified |
65 | 70 | #[arg( |
66 | 71 | short = 'p', |
67 | | - help = "Execute the more command(s) in the command arguments in the order specified." |
| 72 | + long = "execute", |
| 73 | + help = gettext("Execute the more command(s) in the command arguments in the order specified") |
68 | 74 | )] |
69 | 75 | commands: Option<String>, |
70 | 76 |
|
71 | 77 | /// Squeeze multiple blank lines into one |
72 | | - #[arg(short = 's', help = "Squeeze multiple blank lines into one.")] |
| 78 | + #[arg( |
| 79 | + short = 's', |
| 80 | + long = "squeeze", |
| 81 | + help = gettext("Squeeze multiple blank lines into one") |
| 82 | + )] |
73 | 83 | squeeze: bool, |
74 | 84 |
|
75 | 85 | /// Write the screenful of the file containing the tag named by the tagstring argument |
76 | 86 | #[arg( |
77 | 87 | short = 't', |
78 | | - help = "Write the screenful of the file containing the tag named by the tagstring argument." |
| 88 | + long = "tag", |
| 89 | + help = gettext("Write the screenful of the file containing the tag named by the tagstring argument") |
79 | 90 | )] |
80 | 91 | tag: Option<String>, |
81 | 92 |
|
82 | 93 | /// Suppress underlining and bold |
83 | | - #[arg(short = 'u', help = "Suppress underlining and bold.")] |
| 94 | + #[arg( |
| 95 | + short = 'u', |
| 96 | + long = "plain", |
| 97 | + help = gettext("Suppress underlining and bold") |
| 98 | + )] |
84 | 99 | plain: bool, |
85 | 100 |
|
86 | 101 | /// The number of lines per screenful |
87 | | - #[arg(short = 'n', help = "The number of lines per screenful.")] |
| 102 | + #[arg( |
| 103 | + short = 'n', |
| 104 | + long = "lines", |
| 105 | + help = gettext("The number of lines per screenful") |
| 106 | + )] |
88 | 107 | lines: Option<u16>, |
89 | 108 |
|
| 109 | + /// Enable interactive session test |
| 110 | + #[arg( |
| 111 | + short = 'd', |
| 112 | + long = "test", |
| 113 | + help = gettext("Enable interactive session test") |
| 114 | + )] |
| 115 | + test: bool, |
| 116 | + |
90 | 117 | /// A pathnames of an input files |
91 | | - #[arg(name = "FILE", help = "A pathnames of an input files.")] |
| 118 | + #[arg( |
| 119 | + name = "FILES", |
| 120 | + help = gettext("A pathnames of input files") |
| 121 | + )] |
92 | 122 | input_files: Vec<String>, |
93 | 123 | } |
94 | 124 |
|
|
0 commit comments