From f4def1773bd4c4699e6415f48274238e609788ae Mon Sep 17 00:00:00 2001 From: "Spiss, Lukas" Date: Mon, 26 Aug 2019 11:43:15 +0200 Subject: [PATCH] Parse boolean arguments in execute --- README.md | 10 +++++----- package.json | 2 +- src/commands/execute.ts | 8 ++++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b5e80ac..83ccdbc 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ $ npm install -g gassi-cli $ gassi COMMAND running command... $ gassi (-v|--version|version) -gassi-cli/0.1.0 linux-x64 node-v10.16.0 +gassi-cli/0.1.2 linux-x64 node-v10.16.0 $ gassi --help [COMMAND] USAGE $ gassi COMMAND @@ -53,7 +53,7 @@ OPTIONS -u, --uri=uri (required) uri of the service ``` -_See code: [src/commands/disconnect.ts](https://github.com/Spissable/gassi-cli/blob/v0.1.0/src/commands/disconnect.ts)_ +_See code: [src/commands/disconnect.ts](https://github.com/Spissable/gassi-cli/blob/v0.1.2/src/commands/disconnect.ts)_ ## `gassi execute PARAMNAME PARAMVALUE` @@ -71,7 +71,7 @@ OPTIONS -u, --uri=uri (required) uri of the service ``` -_See code: [src/commands/execute.ts](https://github.com/Spissable/gassi-cli/blob/v0.1.0/src/commands/execute.ts)_ +_See code: [src/commands/execute.ts](https://github.com/Spissable/gassi-cli/blob/v0.1.2/src/commands/execute.ts)_ ## `gassi help [COMMAND]` @@ -105,7 +105,7 @@ OPTIONS -u, --uri=uri (required) uri of the service ``` -_See code: [src/commands/query.ts](https://github.com/Spissable/gassi-cli/blob/v0.1.0/src/commands/query.ts)_ +_See code: [src/commands/query.ts](https://github.com/Spissable/gassi-cli/blob/v0.1.2/src/commands/query.ts)_ ## `gassi sync` @@ -121,5 +121,5 @@ OPTIONS -u, --uri=uri (required) uri of the service ``` -_See code: [src/commands/sync.ts](https://github.com/Spissable/gassi-cli/blob/v0.1.0/src/commands/sync.ts)_ +_See code: [src/commands/sync.ts](https://github.com/Spissable/gassi-cli/blob/v0.1.2/src/commands/sync.ts)_ diff --git a/package.json b/package.json index e948ade..985b0c5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "gassi-cli", "description": "Run SYNC, QUERY, EXECUTE and DISCONNECT requests on Google SmartHome easily", - "version": "0.1.1", + "version": "0.1.2", "author": "Spiss, Lukas @Spissable", "bin": { "gassi": "./bin/run" diff --git a/src/commands/execute.ts b/src/commands/execute.ts index 29eb04e..78b5c0c 100644 --- a/src/commands/execute.ts +++ b/src/commands/execute.ts @@ -41,16 +41,20 @@ export default class Execute extends Command { async run() { const { args, flags } = this.parse(Execute); + const paramValue = + args.paramValue == "true" || args.paramValue == "false" + ? args.paramValue == "true" + : args.paramValue; const command = flags.command; const requestId = uuid(); const commandParams = command === "SetModes" ? { updateModeSettings: { - [args.paramName]: args.paramValue + [args.paramName]: paramValue } } - : { [args.paramName]: args.paramValue }; + : { [args.paramName]: paramValue }; await axios .post(