diff --git a/src/cellar.cpp b/src/cellar.cpp index e00c684..c87b81c 100644 --- a/src/cellar.cpp +++ b/src/cellar.cpp @@ -32,9 +32,13 @@ int main(int argc, char* argv[]) { const string desc = "bottle management tool for WINE connoisseurs"; const string versionstr = version::short_version(); TCLAP::CmdLine cmdparse(desc, ' ', versionstr, false); + TCLAP::UnlabeledValueArg command("command", "Specific command to run.", true, "help", "command"); cmdparse.add(command); + TCLAP::UnlabeledMultiArg subargs("subargs", "Sub-arguments", false, "", "subarg"); + cmdparse.add(subargs); + cmdparse.parse(argc, argv); for (auto item : commands::bottles_commands()) { @@ -43,9 +47,8 @@ int main(int argc, char* argv[]) { string usercmd = command.getValue(); if (commands::command_map.count(usercmd) > 0) { - int subargc = 0; - vector subargv; - commands::command_map[usercmd](subargc, subargv); + vector subargv = subargs.getValue(); + commands::command_map[usercmd](subargv.size(), subargv); } else { cerr << "invalid command: " << usercmd << endl; return 1;