From af056ee96136e87e2e1ccb04a3ac33e1e2ab080a Mon Sep 17 00:00:00 2001 From: Nicholas O'Connor Date: Thu, 23 Mar 2017 17:23:59 -0700 Subject: [PATCH] subargv[0] is now the expected value of "cellar " --- src/bottles/activate.cpp | 2 +- src/cellar.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/bottles/activate.cpp b/src/bottles/activate.cpp index 7062d0b..a446e73 100644 --- a/src/bottles/activate.cpp +++ b/src/bottles/activate.cpp @@ -8,5 +8,5 @@ using namespace std; void cellar::bottles::switch_active_bottle(int argc, vector argv) { - cout << argc << endl; + cout << argv[0] << endl; } diff --git a/src/cellar.cpp b/src/cellar.cpp index c87b81c..c8d24b8 100644 --- a/src/cellar.cpp +++ b/src/cellar.cpp @@ -47,7 +47,14 @@ int main(int argc, char* argv[]) { string usercmd = command.getValue(); if (commands::command_map.count(usercmd) > 0) { - vector subargv = subargs.getValue(); + vector subargv; + stringstream sstr; + sstr << "cellar "; + sstr << usercmd; + subargv.push_back(sstr.str()); + for (auto item : subargs.getValue()) { + subargv.push_back(item); + } commands::command_map[usercmd](subargv.size(), subargv); } else { cerr << "invalid command: " << usercmd << endl;