|
| 1 | +/* |
| 2 | + * fetchfetch - Fetch the stats of your *fetch tools |
| 3 | + * Copyright (C) 2025 Spenser Black |
| 4 | + * |
| 5 | + * This program is free software: you can redistribute it and/or modify |
| 6 | + * it under the terms of the GNU General Public License as published by |
| 7 | + * the Free Software Foundation, either version 3 of the License, or |
| 8 | + * (at your option) any later version. |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * You should have received a copy of the GNU General Public License |
| 14 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 15 | + */ |
| 16 | +#include <stdbool.h> |
| 17 | +#include <string.h> |
| 18 | +#include "args.h" |
| 19 | + |
| 20 | +bool print_help = false; |
| 21 | +bool print_version = false; |
| 22 | + |
| 23 | +void parse_args(int argc, char **argv) { |
| 24 | + for (int i = 1; i < argc; i++) { |
| 25 | + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { |
| 26 | + print_help = true; |
| 27 | + } else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0) { |
| 28 | + print_version = true; |
| 29 | + } |
| 30 | + } |
| 31 | +} |
| 32 | + |
| 33 | +const char *help_message = "Usage: fetchfetch [OPTIONS...]\n" |
| 34 | + "Fetch the stats of your *fetch tools\n" |
| 35 | + "\n" |
| 36 | + "Options:\n" |
| 37 | + " -h, --help Print this message and exit\n" |
| 38 | + " -v, --version Print the version and exit\n"; |
0 commit comments