From 7918b26f654b0d84527f8001a7da68056cb8005c Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 29 Jun 2016 12:22:37 -0700 Subject: [PATCH] Hack settings into old CLI. --- one.cpp | 73 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 17 deletions(-) diff --git a/one.cpp b/one.cpp index d50cc25ea..6bd5a34d8 100644 --- a/one.cpp +++ b/one.cpp @@ -86,6 +86,8 @@ static OneService *volatile zt1Service = (OneService *)0; /* zerotier-cli personality */ /****************************************************************************/ +// This is getting deprecated soon in favor of the stuff in cli/ + static void cliPrintHelp(const char *pn,FILE *out) { fprintf(out, @@ -97,19 +99,19 @@ static void cliPrintHelp(const char *pn,FILE *out) LICENSE_GRANT ZT_EOL_S); fprintf(out,"Usage: %s [-switches] []"ZT_EOL_S""ZT_EOL_S,pn); fprintf(out,"Available switches:"ZT_EOL_S); - fprintf(out," -h - Display this help"ZT_EOL_S); - fprintf(out," -v - Show version"ZT_EOL_S); - fprintf(out," -j - Display full raw JSON output"ZT_EOL_S); - fprintf(out," -D - ZeroTier home path for parameter auto-detect"ZT_EOL_S); - fprintf(out," -p - HTTP port (default: auto)"ZT_EOL_S); - fprintf(out," -T - Authentication token (default: auto)"ZT_EOL_S); - //fprintf(out," -H - HTTP server bind address (default: 127.0.0.1)"ZT_EOL_S); + fprintf(out," -h - Display this help"ZT_EOL_S); + fprintf(out," -v - Show version"ZT_EOL_S); + fprintf(out," -j - Display full raw JSON output"ZT_EOL_S); + fprintf(out," -D - ZeroTier home path for parameter auto-detect"ZT_EOL_S); + fprintf(out," -p - HTTP port (default: auto)"ZT_EOL_S); + fprintf(out," -T - Authentication token (default: auto)"ZT_EOL_S); fprintf(out,ZT_EOL_S"Available commands:"ZT_EOL_S); - fprintf(out," info - Display status info"ZT_EOL_S); - fprintf(out," listpeers - List all peers"ZT_EOL_S); - fprintf(out," listnetworks - List all networks"ZT_EOL_S); - fprintf(out," join - Join a network"ZT_EOL_S); - fprintf(out," leave - Leave a network"ZT_EOL_S); + fprintf(out," info - Display status info"ZT_EOL_S); + fprintf(out," listpeers - List all peers"ZT_EOL_S); + fprintf(out," listnetworks - List all networks"ZT_EOL_S); + fprintf(out," join - Join a network"ZT_EOL_S); + fprintf(out," leave - Leave a network"ZT_EOL_S); + fprintf(out," set - Set a network setting"ZT_EOL_S); } static std::string cliFixJsonCRs(const std::string &s) @@ -130,10 +132,7 @@ static int cli(int argc,char **argv) #endif { unsigned int port = 0; - std::string homeDir; - std::string command; - std::string arg1; - std::string authToken; + std::string homeDir,command,arg1,arg2,authToken; std::string ip("127.0.0.1"); bool json = false; for(int i=1;i