summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2013-08-05 16:11:16 -0400
committerAdam Ierymenko <adam.ierymenko@gmail.com>2013-08-05 16:11:16 -0400
commit70f368fdc36cd91a3be0218fba7b2d4c6a8bc96f (patch)
tree94d289279cfd472ec3f09ba6cb2f9dc5945cdc61
parenta7c4cbe53aad51b3e74fa9cb1af975cb8d356954 (diff)
downloadinfinitytier-70f368fdc36cd91a3be0218fba7b2d4c6a8bc96f.tar.gz
infinitytier-70f368fdc36cd91a3be0218fba7b2d4c6a8bc96f.zip
CLI now actually sends commands... :P
-rw-r--r--cli.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/cli.cpp b/cli.cpp
index 38237733..46c8dd61 100644
--- a/cli.cpp
+++ b/cli.cpp
@@ -69,9 +69,10 @@ int main(int argc,char **argv)
}
std::string authToken;
-
+ std::string command;
+ bool pastSwitches = false;
for(int i=1;i<argc;++i) {
- if (argv[i][0] == '-') {
+ if ((argv[i][0] == '-')&&(!pastSwitches)) {
if (strlen(argv[i]) <= 1) {
printHelp(stdout,argv[0]);
return -1;
@@ -89,6 +90,11 @@ int main(int argc,char **argv)
default:
return -1;
}
+ } else {
+ pastSwitches = true;
+ if (command.length())
+ command.push_back(' ');
+ command.append(argv[i]);
}
}
@@ -109,7 +115,8 @@ int main(int argc,char **argv)
return -2;
}
- Node::LocalClient(authToken.c_str(),&resultHandler,(void *)0);
+ Node::LocalClient client(authToken.c_str(),&resultHandler,(void *)0);
+ client.send(command.c_str());
lastResultTime = Utils::now();
while ((Utils::now() - lastResultTime) < 300)