Skip to content

Commit

Permalink
Parse boolean arguments in execute
Browse files Browse the repository at this point in the history
  • Loading branch information
Spissable committed Aug 26, 2019
1 parent a3d697b commit f4def17
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`

Expand All @@ -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]`

Expand Down Expand Up @@ -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`

Expand All @@ -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)_
<!-- commandsstop -->
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 6 additions & 2 deletions src/commands/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit f4def17

Please sign in to comment.