move config to its own subdir, preparation for #24

This commit is contained in:
Nicholas O'Connor 2017-04-13 15:02:50 -07:00
parent 404076539b
commit fc814d1cb3
9 changed files with 42 additions and 8 deletions

View File

@ -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")

View File

@ -0,0 +1,30 @@
// vim: filetype=cpp :
#ifndef __INTERNAL_CORE_HPP
#define __INTERNAL_CORE_HPP
#pragma once
#include <map>
#include <string>
#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<string>);".format(item[1]))
]]]*/
//[[[end]]]
}
namespace commands {
extern map<string, cellar::commands::CommandFunction> config_commands();
}
}
#endif // __INTERNAL_CORE_HPP

View File

@ -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.

View File

@ -4,9 +4,13 @@
#include <vector>
#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<string> cellar::commands::list_commands() {
}
/*[[[cog
import cog
import os
import os.path

View File

@ -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<string> argv) {
void cellar::config::config_command(int argc, vector<string> argv) {
if (argc == 1) {
output::error("not enough arguments");
return;

1
src/config/commands.txt Normal file
View File

@ -0,0 +1 @@
config config_command Change configuration options.

View File

@ -1,3 +1,4 @@
core
config
bottles
launch