Skip to content

Commit

Permalink
Update help message to include long options
Browse files Browse the repository at this point in the history
  • Loading branch information
fs-c committed May 1, 2020
1 parent 70c1319 commit f9bd86b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ It attemps to be
Options:
-p id of game process (optional)
-l humanization level (default: 0)
-a address to read time from (optional)
-m path to beatmap (optional)
-r replay humanization level delta (optional)
-e toggle exit checks in game loop (default: on)
-h print this message
-p / --process id of game process (optional)
-l / --humanization humanization level (default: 0)
-a / --address address to read time from (optional)
-m / --map path to beatmap (optional)
-r / --replay replay humanization level delta (optional)
-e / --exit-checks toggle exit checks in game loop (default: on)
-h / --help print this message
```

Expand Down
34 changes: 20 additions & 14 deletions src/maniac.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int main(int argc, char **argv) {
{ "address", required_argument, NULL, 'a' },
{ "humanization", required_argument, NULL, 'l' },
{ "replay", optional_argument, NULL, 'r' },
{ "exit-check", no_argument, NULL, 'e' },
{ "exit-checks", no_argument, NULL, 'e' },
{ "help", no_argument, NULL, 'h' },
{ NULL, 0, NULL, 0 },
};
Expand Down Expand Up @@ -278,12 +278,12 @@ static int play(char *map) {
// looping and the other is called in a loop. Investigate a clean,
// consistent solution.
static void play_loop(struct action *actions, int num_actions) {
int cur_i = 0; // Current action offset.
struct action *cur_a = NULL; // Pointer to current action.
int32_t time = get_maptime(); // Current maptime.
int cur_i = 0; // Current action offset.
struct action *cur_a = NULL; // Pointer to current action.
int32_t time = get_maptime(); // Current maptime.

const int title_len = 128; // Max length of title.
char *title = malloc(title_len); // Current window title.
const int title_len = 128; // Max length of title.
char *title = malloc(title_len); // Current window title.

// Discard all actions which come before our current maptime.
for (; cur_i < num_actions; cur_i++)
Expand Down Expand Up @@ -323,12 +323,18 @@ static void print_usage() {
printf(" Usage: ./maniac [options]\n\n");
printf(" Options: \n\n");

printf(" %-10s id of game process (optional)\n", "-p");
printf(" %-10s humanization level (default: 0)\n", "-l");
printf(" %-10s address to read time from (optional)\n", "-a");
printf(" %-10s path to beatmap (optional)\n", "-m");
printf(" %-10s replay humanization level delta (optional)\n", "-r");
printf(" %-10s toggle exit checks in game loop (default: on)\n",
"-e");
printf(" %-10s print this message\n", "-h");
printf(" %s / %-15s id of game process (optional)\n",
"-p", "--process");
printf(" %s / %-15s humanization level (default: 0)\n",
"-l", "--humanization");
printf(" %s / %-15s address to read time from (optional)\n",
"-a", "--address");
printf(" %s / %-15s path to beatmap (optional)\n",
"-m", "--map");
printf(" %s / %-15s replay humanization level delta (optional)\n",
"-r", "--replay");
printf(" %s / %-15s toggle exit checks in game loop (default: on)\n",
"-e", "--exit-checks");
printf(" %s / %-15s print this message\n",
"-h", "--help");
}

0 comments on commit f9bd86b

Please sign in to comment.