From 04f2c46def8628cf26ea09ae279c1299916a6a4e Mon Sep 17 00:00:00 2001 From: Nicholas O'Connor Date: Fri, 24 Mar 2017 15:57:49 -0700 Subject: [PATCH] beginnings of a config command --- CMakeLists.txt | 4 ++-- src/bottles/commands.txt | 1 + src/bottles/config/cli_handler.cpp | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 src/bottles/config/cli_handler.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 41f3798..9bfdd79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,14 +44,14 @@ foreach(cogfile ${cogfiles}) COMMAND ${PYTHON_EXECUTABLE} -m cogapp -d -o "${outfile}" "${cogfile}" DEPENDS ${cogfile} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMENT "Greasing the cog for ${thisfile}") + COMMENT "Greasing the cog for ${outfile}") set(coggedfiles ${coggedfiles} "${thisfile}") endforeach(cogfile) add_library(bottles SHARED ${src}/bottles/bottles.cpp ${src}/bottles/active.cpp ${src}/bottles/commands.cpp - ${src}/bottles/activate.cpp) + ${src}/bottles/activate.cpp ${src}/bottles/config/cli_handler.cpp) add_dependencies(bottles cog) add_library(launch SHARED ${src}/launch/launch.cpp ${src}/launch/commands.cpp diff --git a/src/bottles/commands.txt b/src/bottles/commands.txt index 48cc991..6e8ab3e 100644 --- a/src/bottles/commands.txt +++ b/src/bottles/commands.txt @@ -1,3 +1,4 @@ list print_bottles active print_active_bottle activate switch_active_bottle +config config_command diff --git a/src/bottles/config/cli_handler.cpp b/src/bottles/config/cli_handler.cpp new file mode 100644 index 0000000..a11ffee --- /dev/null +++ b/src/bottles/config/cli_handler.cpp @@ -0,0 +1,24 @@ +#include +#include + +#include "json.hpp" + +#include "bottles.hpp" +#include "internal/bottles.hpp" +#include "output.hpp" + +using namespace std; +using namespace cellar; +using namespace cellar::bottles; + +using json = nlohmann::json; + +void cellar::bottles::config_command(int argc, vector argv) { + if (argc == 1) { + output::error("not enough arguments"); + return; + } + string command = argv[1]; + + output::statement(command); +}