From cb77717650421b5a0cdf55866c6a27abc3d25ff0 Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Wed, 21 Dec 2016 14:33:34 +0100 Subject: [PATCH] Starting instances now require "start" as second param, instance 3rd --- client.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/client.js b/client.js index ff307a6e..f5923a50 100644 --- a/client.js +++ b/client.js @@ -27,20 +27,20 @@ function getDirectories(srcpath) { if (!fs.existsSync("./instances/")) { fs.mkdirSync("instances"); } -var instance = process.argv[2]; +var instance = process.argv[3]; var instancedirectory = './instances/' + instance; - +var command = process.argv[2]; // handle commandline parameters -if (!instance || instance == "help" || instance == "--help") { +if (!command || command == "help" || command == "--help") { console.error("Usage: ") - console.error("node client.js [instance name]") + console.error("node client.js start [instance name]") console.error("node client.js list") console.error("node client.js delete [instance]") process.exit(1) -} else if (process.argv[2] == "list") { +} else if (command == "list") { console.dir(getDirectories("./instances/")); process.exit(1) -} else if (process.argv[2] == "delete") { +} else if (command == "delete") { if (!process.argv[3]) { console.error("Usage: node client.js delete [instance]"); process.exit(1) @@ -52,7 +52,7 @@ if (!instance || instance == "help" || instance == "--help") { console.error("Instance not found: " + process.argv[3]); process.exit(1) } -} else if (!fs.existsSync(instancedirectory)) { +} else if (command == "start" && typeof instance == "string" && instance != "/" && !fs.existsSync(instancedirectory)) { // if instance does not exist, create it console.log("Creating instance...") fs.mkdirSync(instancedirectory);