Github User Fetcher 1.0.0
C Application with Server and GUI
|
Contains logic for parsing command-line arguments into an AppConfig object. More...
#include "config.hpp"
#include <stdexcept>
Go to the source code of this file.
Functions | |
AppConfig | parse_arguments (const std::vector< std::string > &args) |
Parses command-line arguments into an AppConfig structure. | |
Contains logic for parsing command-line arguments into an AppConfig object.
This file provides the implementation of a utility function that translates raw command-line input into structured configuration for the application.
Definition in file config.cpp.
AppConfig parse_arguments | ( | const std::vector< std::string > & | args | ) |
Parses command-line arguments into an AppConfig structure.
This function iterates over the provided command-line arguments and looks for:
--user <username>
or --user=<username>
: Sets the GitHub username to fetch.--server
: Indicates that the HTTP server should be started.--port=<number>
: Sets the port number for the HTTP server.Invalid port values will cause an exception to be thrown.
args | A list of command-line arguments, excluding the program name. |
std::invalid_argument | If the port value is not a valid integer. |
Definition at line 31 of file config.cpp.
References arg.
Referenced by main(), TEST_CASE(), TEST_CASE(), TEST_CASE(), and TEST_CASE().