fix made --help work correctly
This commit is contained in:
+14
-9
@@ -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"
|
||||
"--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"
|
||||
"--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);
|
||||
|
||||
Reference in New Issue
Block a user