|
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 plib::PROJECT_NAME;
|
13 | 13 | use std::{
|
14 | 14 | error::Error,
|
@@ -102,39 +102,28 @@ static KILL_AFTER: Mutex<Option<Duration>> = Mutex::new(None);
|
102 | 102 | static MONITORED_PID: AtomicI32 = AtomicI32::new(0);
|
103 | 103 | static TIMED_OUT: AtomicBool = AtomicBool::new(false);
|
104 | 104 |
|
105 |
| -/// timeout — execute a utility with a time limit |
106 | 105 | #[derive(Parser)]
|
107 |
| -#[command(version, about)] |
| 106 | +#[command(version, about = gettext("timeout — execute a utility with a time limit"))] |
108 | 107 | struct Args {
|
109 |
| - /// Only time out the utility itself, not its descendants. |
110 |
| - #[arg(short = 'f', long)] |
| 108 | + #[arg(short = 'f', long, help=gettext("Only time out the utility itself, not its descendants."))] |
111 | 109 | foreground: bool,
|
112 | 110 |
|
113 |
| - /// Always preserve (mimic) the wait status of the executed utility, even if the time limit was reached. |
114 |
| - #[arg(short = 'p', long)] |
| 111 | + #[arg(short = 'p', long, help=gettext("Preserve the exit status of the utility."))] |
115 | 112 | preserve_status: bool,
|
116 | 113 |
|
117 |
| - /// Send a SIGKILL signal if the child process created to execute the utility has not terminated after the time period |
118 |
| - /// specified by time has elapsed since the first signal was sent. The value of time shall be interpreted as specified for |
119 |
| - /// the duration operand. |
120 |
| - #[arg(short = 'k', long, value_parser = parse_duration)] |
| 114 | + #[arg(short = 'k', long, value_parser = parse_duration, help=gettext("Send a SIGKILL signal if the child process has not terminated after the time period."))] |
121 | 115 | kill_after: Option<Duration>,
|
122 | 116 |
|
123 |
| - /// Specify the signal to send when the time limit is reached, using one of the symbolic names defined in the <signal.h> header. |
124 |
| - /// Values of signal shall be recognized in a case-independent fashion, without the SIG prefix. By default, SIGTERM shall be sent. |
125 |
| - #[arg(short = 's', long, default_value = "TERM", value_parser = parse_signal)] |
| 117 | + #[arg(short = 's', long, default_value = "TERM", value_parser = parse_signal, help=gettext("Specify the signal to send when the time limit is reached."))] |
126 | 118 | signal_name: i32,
|
127 | 119 |
|
128 |
| - /// The maximum amount of time to allow the utility to run, specified as a decimal number with an optional decimal fraction and an optional suffix. |
129 |
| - #[arg(name = "DURATION", value_parser = parse_duration)] |
| 120 | + #[arg(name = "DURATION", value_parser = parse_duration, help=gettext("The maximum amount of time to allow the utility to run, specified as a decimal number with an optional decimal fraction and an optional suffix."))] |
130 | 121 | duration: Duration,
|
131 | 122 |
|
132 |
| - /// The name of a utility that is to be executed. |
133 |
| - #[arg(name = "UTILITY")] |
| 123 | + #[arg(name = "UTILITY", help=gettext("The utility to execute."))] |
134 | 124 | utility: String,
|
135 | 125 |
|
136 |
| - /// Any string to be supplied as an argument when executing the utility named by the utility operand. |
137 |
| - #[arg(name = "ARGUMENT", trailing_var_arg = true)] |
| 126 | + #[arg(name = "ARGUMENT", trailing_var_arg = true, help=gettext("Arguments to pass to the utility."))] |
138 | 127 | arguments: Vec<String>,
|
139 | 128 | }
|
140 | 129 |
|
|
0 commit comments