diff --git a/.gitignore b/.gitignore index d73e005..d15306b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .cache -build \ No newline at end of file +build + +config.toml \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..570a496 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "cmake.debugConfig": { + "cwd": "${workspaceFolder}" + } +} \ No newline at end of file diff --git a/include/config/config.h b/include/config/config.h new file mode 100644 index 0000000..d4309ba --- /dev/null +++ b/include/config/config.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include +#include + +#include "programs_config.h" + +class Config { +public: + ProgramsConfig programs; + + Config(const std::string& config_path) { + toml::value toml = toml::parse(config_path); + + programs = ProgramsConfig(toml["programs"]); + } +}; \ No newline at end of file diff --git a/include/config/programs_config.h b/include/config/programs_config.h new file mode 100644 index 0000000..82a2177 --- /dev/null +++ b/include/config/programs_config.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include +#include + +class ProgramsConfig { +public: + std::string terminal; + std::string launcher; + + /* ProgramsConfig(const std::string& config_path) : ProgramsConfig(toml::parse(config_path)) { + + } */ + + ProgramsConfig() = default; + + ProgramsConfig(toml::value& toml_config) { + terminal = toml_config["terminal"].as_string(); + launcher = toml_config["launcher"].as_string(); + } +}; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 0862618..79050c3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,11 @@ #include +#include "config/config.h" + int main() { - std::cout << "hello world" << std::endl; + Config config("config.toml"); + + std::cout << "Terminal: \"" << config.programs.terminal << "\" - Launcher: \"" << config.programs.launcher << "\"" << std::endl; + return 0; } \ No newline at end of file