diff --git a/src/main.cpp b/src/main.cpp index d3b18f8..e6dcf92 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -57,7 +57,7 @@ std::pair mapKeyEventToRowColumn(int keyEventNumber, const std::unorde std::string getConfigPathFromCliArguments(int argc, char *argv[]) { - std::string configPath = ""; + std::string configPath = "config.yaml"; int opt; while ((opt = getopt(argc, argv, "c:")) != -1) { @@ -67,14 +67,18 @@ std::string getConfigPathFromCliArguments(int argc, char *argv[]) configPath = optarg; break; default: - std::cout << "No config path provided. Using default config path: $HOME/.config/UsbMakroBoard.yaml\n"; - configPath = "$HOME/.config/UsbMakroBoard.yaml"; + std::cerr << "Usage: " << argv[0] << " [-c config_file_path]\n"; + exit(EXIT_FAILURE); } } - return configPath; } +YAML::Node loadConfig(const std::string &configPath) +{ + return YAML::LoadFile(configPath); +} + int openDevice(const std::string &devicePath) { int fdKeyboard = open(devicePath.c_str(), O_RDONLY);