| 352 | } |
| 353 | |
| 354 | static int process_help(int argc, char *argv[], const char store_file[]) |
| 355 | { |
| 356 | (void)store_file; |
| 357 | |
| 358 | if (argc == 1) { |
| 359 | print_help(); |
| 360 | return EXIT_SUCCESS; |
| 361 | } |
| 362 | |
| 363 | if (argc != 2) { |
| 364 | fprintf(stderr, "Invalid invocation\n"); |
| 365 | print_sub_command_usage(argv[0]); |
| 366 | return EXIT_FAILURE; |
| 367 | } |
| 368 | |
| 369 | const char *sub_command = argv[1]; |
| 370 | |
| 371 | for (int i = 0; i < sub_command_count; ++i) { |
| 372 | const struct subcommand_t *cmd = &sub_commands[i]; |
| 373 | if (!str_eq(cmd->name, sub_command)) |
| 374 | continue; |
| 375 | |
| 376 | cmd->print_help(stdout, cmd); |
| 377 | return EXIT_SUCCESS; |
| 378 | } |
| 379 | |
| 380 | fprintf(stderr, "Unknown sub-command: %s\n", sub_command); |
| 381 | print_help(); |
| 382 | return EXIT_FAILURE; |
| 383 | } |
| 384 | |
| 385 | static void help_remove(FILE *f, const struct subcommand_t *info) |
| 386 | { |
nothing calls this directly
no test coverage detected