fix made --help work correctly

This commit is contained in:
bePrivate
2023-10-31 11:18:02 +01:00
parent f2d1f719a9
commit 48c3f7d08c
2 changed files with 16 additions and 11 deletions
BIN
View File
Binary file not shown.
+16 -11
View File
@@ -72,18 +72,17 @@ void print_help_and_usage() {
"Help and usage for Wordle:\n"
"\n"
"Help:\n"
"--wordlist <path_to_wordlist_file> ... specify a custom wordlist\n"
" RULES: five characters on each line (no empty lines),\n"
" each new line is separated by '\\n' (Enter/Return)\n"
"--verbose ............................ be verbose (show what the program is doing aka debug info)\n"
"--help ............................... show this help screen\n"
"--wordlist <path_to_wordlist_file> ........... specify a custom wordlist\n"
" RULES: five characters on each line (no empty lines),\n"
" each new line is separated by '\\n' (Enter/Return)\n"
"--verbose .................................... be verbose (show what the program is doing aka debug info)\n"
"--help ....................................... show this help screen\n"
"\n"
"Usage:\n"
"\n"
"wordle\n"
"=> starts Wordle with the default wordlist\n"
"wordle --wordlist <path_to_wordlist_file>\n"
"=> starts Wordle with a specified wordlist\n"
"wordlec ...................................... starts Wordle with the default wordlist\n"
"\n"
"wordlec --wordlist <path_to_wordlist_file> ... starts Wordle with a specified wordlist\n"
);
}
@@ -297,7 +296,7 @@ int argparse(int argc, char *argv[]) {
if (strcmp(argv[i], "--help") == 0) {
print_help_and_usage();
return 0;
return 2;
}
/*
@@ -344,7 +343,13 @@ void show_win_lose_message() {
int main(int argc, char *argv[]) {
// pass the arguments
if (argparse(argc, argv) == 1) return 1;
int args = argparse(argc, argv);
switch (args) {
case 1:
return 1;
case 2:
return 0; // --help passed
}
// prerequisite 1
get_random_word(word_to_guess, wordlist_path);