summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Pereiaslov <perk11@perk11.info>2024-01-07 01:15:54 -0600
committerKonstantin Pereiaslov <perk11@perk11.info>2024-01-07 01:15:54 -0600
commita06837530e510031c16baf2b4fc858cf31e4a982 (patch)
treeddf0ee4f7f64fe78254446614b2e09cc3a52307c
parentae47d9dfdc0a6cfbd6805c319777f2409b6f9580 (diff)
Improve formatting of usage
-rw-r--r--README.md2
-rw-r--r--arguments_parsing.c25
2 files changed, 18 insertions, 9 deletions
diff --git a/README.md b/README.md
index 19ab33f..e6b2fee 100644
--- a/README.md
+++ b/README.md
@@ -75,9 +75,9 @@ If you want to install it system-wide, run `sudo make install` or simply `sudo c
| `--pid\|-p <pid>` | Monitor an existing process. When this option is used, shell_command_to_run should not be passed. | |
| `--start-monitor-after\| -a <ms>` | Set an initial delay in milliseconds before monitoring starts. During this time the process runs unrestricted. This helps to catch quick errors. | 300 ms |
| `--pause-method\| -m <method>` | Specify method for pausing the process when the user is not idle. Available Options: SIGTSTP (can be ignored by the program), SIGSTOP (cannot be ignored). | SIGSTOP |
+| `--quiet\| -q` | Suppress all output from ./runwhenidle except errors and only display output from the command that is running. No output if `--pid` options is used. | Not quiet |
| `--verbose\| -v` | Enable verbose output for monitoring. | Not verbose |
| `--debug` | Enable debugging output. | No debug |
-| `--quiet\| -q` | Suppress all output from ./runwhenidle except errors and only display output from the command that is running. No output if `--pid` options is used. | Not quiet |
| `--version\| -V` | Print the program version information. | |
diff --git a/arguments_parsing.c b/arguments_parsing.c
index 2e67108..4ea4397 100644
--- a/arguments_parsing.c
+++ b/arguments_parsing.c
@@ -19,14 +19,23 @@ const long START_MONITOR_AFTER_MIN_SUPPORTED_VALUE = 0;
void print_usage(char *binary_name) {
printf("Usage: %s [OPTIONS] [shell_command_to_run] [shell_command_arguments]\n", binary_name);
printf("\nOptions:\n");
- printf(" --timeout|-t <seconds> Set the user idle time after which the process can be resumed in seconds. (default: 300 seconds).\n");
- printf(" --pid|-p <pid> Monitor an existing process. When this option is used, shell_command_to_run should not be passed.\n");
- printf(" --start-monitor-after|-a <ms> Set an initial delay in milliseconds before monitoring starts. During this time the process runs unrestricted. This helps to catch quick errors. (default: 300 ms).\n");
- printf(" --pause-method|-m <method> Specify method for pausing the process when the user is not idle. Available Options: SIGTSTP (can be ignored by the program), SIGSTOP (cannot be ignored). (default: SIGSTOP).\n");
- printf(" --verbose|-v Enable verbose output for monitoring.\n");
- printf(" --debug Enable debugging output.\n");
- printf(" --quiet|-q Suppress all output from %s except errors and only display output from the command that is running. No output if --pid options is used.\n", binary_name);
- printf(" --version|-V Print the program version information.\n");
+ printf(" --timeout|-t <seconds> Set the user idle time after which the process\n"
+ " can be resumed in seconds. (default: 300 seconds).\n\n");
+ printf(" --pid|-p <pid> Monitor an existing process. When this option is used,\n"
+ " shell_command_to_run should not be passed.\n\n");
+ printf(" --start-monitor-after|-a <ms> Set an initial delay in milliseconds before monitoring\n"
+ " starts. During this time the process runs unrestricted.\n"
+ " This helps to catch quick errors. (default: 300 ms).\n\n");
+ printf(" --pause-method|-m <method> Specify method for pausing the process when the user is\n"
+ " not idle. Available Options (default: SIGSTOP): \n"
+ " SIGTSTP (can be ignored by the program),\n"
+ " SIGSTOP (cannot be ignored).\n\n");
+ printf(" --quiet|-q Suppress all output from %s except errors and only\n"
+ " display output from the command that is running.\n"
+ " No output if --pid options is used.\n\n", binary_name);
+ printf(" --verbose|-v Enable verbose output for monitoring.\n");
+ printf(" --debug Enable debugging output.\n");
+ printf(" --version|-V Print the program version information.\n");
}
void print_version() {