#include "cli.h"
Classes | |
struct | FlagHandler |
Functions | |
void | handle_input_flag (Config *config, const char *value) |
Handles the input file flag (-i or –input). | |
void | handle_threads_flag (Config *config, const char *value) |
Handles the threads flag (-t or –threads). | |
void | handle_generations_flag (Config *config, const char *value) |
Handles the generations flag (-g or –generations). | |
void | handle_decrypt_flag (Config *config, const char *value) |
Handles the decrypt flag (-d or –decrypt). | |
void | handle_help_flag (Config *config, const char *value) |
Handles the help flag (-h or –help). | |
Config | parse_command_line_args (int argc, char *argv[]) |
Parses command-line arguments and populates the Config struct. | |
Variables | |
FlagHandler | flag_handlers [] |
Array of FlagHandler structs, mapping flag names to handler functions. | |
void handle_decrypt_flag | ( | Config * | config, |
const char * | value | ||
) |
Handles the decrypt flag (-d or –decrypt).
config | The Config struct to update. |
value | The value associated with the flag (NULL in this case). |
void handle_generations_flag | ( | Config * | config, |
const char * | value | ||
) |
Handles the generations flag (-g or –generations).
config | The Config struct to update. |
value | The value associated with the flag (generations string). |
void handle_help_flag | ( | Config * | config, |
const char * | value | ||
) |
Handles the help flag (-h or –help).
config | The Config struct to update. |
value | The value associated with the flag (NULL in this case). |
void handle_input_flag | ( | Config * | config, |
const char * | value | ||
) |
Handles the input file flag (-i or –input).
config | The Config struct to update. |
value | The value associated with the flag (input file path). |
void handle_threads_flag | ( | Config * | config, |
const char * | value | ||
) |
Handles the threads flag (-t or –threads).
config | The Config struct to update. |
value | The value associated with the flag (number of threads). |
Config parse_command_line_args | ( | int | argc, |
char * | argv[] | ||
) |
Parses command-line arguments and populates the Config struct.
This function handles the initial parsing of command-line arguments. It identifies flags and their associated values, and it stores them in a preliminary Config object. Further validation and processing of the configuration is done in initialize_config
.
argc | The number of command-line arguments. |
argv | An array of strings containing the command-line arguments. |
error
field will be set to true
if any errors are encountered during parsing. FlagHandler flag_handlers[] |
Array of FlagHandler structs, mapping flag names to handler functions.