diff --git a/CMakeLists.txt b/CMakeLists.txt index b9e659e..03d6609 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,7 +98,7 @@ function(cellar_library) set(cellar_LIBRARIES ${cellar_LIBRARIES} ${target} PARENT_SCOPE) endfunction(cellar_library) -cellar_library(TARGET cellarlib SUBDIRS bottles launch) +cellar_library(TARGET cellarlib SUBDIRS bottles launch config) file(GLOB coresources RELATIVE "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/src/*.cpp") diff --git a/include/internal/config.hpp.cog b/include/internal/config.hpp.cog new file mode 100644 index 0000000..8737928 --- /dev/null +++ b/include/internal/config.hpp.cog @@ -0,0 +1,30 @@ +// vim: filetype=cpp : +#ifndef __INTERNAL_CORE_HPP +#define __INTERNAL_CORE_HPP +#pragma once + +#include +#include + +#include "commands.hpp" + +using namespace cellar::commands; + +namespace cellar { + namespace config { + /*[[[cog + import cog + + with open("src/config/commands.txt") as commandsfile: + for line in commandsfile: + item = line.strip().split(" ") + cog.outl("extern void {0} (int, vector);".format(item[1])) + ]]]*/ + //[[[end]]] + } + namespace commands { + extern map config_commands(); + } +} + +#endif // __INTERNAL_CORE_HPP diff --git a/src/bottles/commands.txt b/src/bottles/commands.txt index 3cdd590..33d0bae 100644 --- a/src/bottles/commands.txt +++ b/src/bottles/commands.txt @@ -1,7 +1,6 @@ list print_bottles List all available WINE bottles. active print_active_bottle Get the currently active WINE bottle. activate switch_active_bottle Switch the active WINE bottle. -config config_command Change configuration options. create create_bottle Create a new WINE bottle. remove remove_bottle Remove a WINE bottle. cork cork_command Cork a bottle, to be "uncorked" later. diff --git a/src/commands.cpp.cog b/src/commands.cpp.cog index 338b3ea..d6bafb3 100644 --- a/src/commands.cpp.cog +++ b/src/commands.cpp.cog @@ -4,9 +4,13 @@ #include #include "commands.hpp" -#include "internal/core.hpp" -#include "internal/bottles.hpp" -#include "internal/launch.hpp" +/*[[[cog + import cog + with open("src/modules.txt") as modulesfile: + for module in modulesfile: + cog.outl("#include \"internal/{0}.hpp\"".format(module.strip())) + ]]]*/ +//[[[end]]] #include "cellar.hpp" #include "help.hpp" @@ -24,7 +28,6 @@ vector cellar::commands::list_commands() { } /*[[[cog - import cog import os import os.path diff --git a/src/bottles/config/cli_handler.cpp b/src/config/cli_handler.cpp similarity index 93% rename from src/bottles/config/cli_handler.cpp rename to src/config/cli_handler.cpp index 20ddf3f..9a23052 100644 --- a/src/bottles/config/cli_handler.cpp +++ b/src/config/cli_handler.cpp @@ -3,7 +3,7 @@ #include "bottles.hpp" #include "cellar.hpp" -#include "internal/bottles.hpp" +#include "internal/config.hpp" #include "output.hpp" using namespace std; @@ -12,7 +12,7 @@ using namespace cellar::bottles; using json = nlohmann::json; -void cellar::bottles::config_command(int argc, vector argv) { +void cellar::config::config_command(int argc, vector argv) { if (argc == 1) { output::error("not enough arguments"); return; diff --git a/src/config/commands.txt b/src/config/commands.txt new file mode 100644 index 0000000..c6d99d6 --- /dev/null +++ b/src/config/commands.txt @@ -0,0 +1 @@ +config config_command Change configuration options. diff --git a/src/bottles/help/config b/src/config/help/config similarity index 100% rename from src/bottles/help/config rename to src/config/help/config diff --git a/src/bottles/config/save_load.cpp b/src/config/save_load.cpp similarity index 100% rename from src/bottles/config/save_load.cpp rename to src/config/save_load.cpp diff --git a/src/modules.txt b/src/modules.txt index 8aee732..d5451df 100644 --- a/src/modules.txt +++ b/src/modules.txt @@ -1,3 +1,4 @@ core +config bottles launch