Skip to content

Commit ac56c68

Browse files
committed
Added ability to pass interger in JSON data via item==value in CLI
1 parent e222ad7 commit ac56c68

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ All API calls can be called from the command line. The command will convert doma
162162
$ cli4 [-h|--help] [-v|--verbose] [-q|--quiet] [--get|--patch|--post|-put|--delete] [item=value ...] /command...
163163
```
164164

165+
For API calls that need a set of date or parameters passed there is a item=value format.
166+
If you want a numeric value passed, then _**_ can be used to force the value to be treated as a numeric value.
167+
165168
The output from the CLI command is in json format (and human readable).
166169

167170
### Simple CLI examples

cli4/cli4.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ def cli4(args):
124124
# next grab the params. These are in the form of tag=value
125125
params = {}
126126
while len(args) > 0 and '=' in args[0]:
127-
tag, value = args.pop(0).split('=')
127+
tag, value = args.pop(0).split('=', 1)
128128
if value == 'true':
129129
value = True
130130
elif value == 'false':
131131
value = False
132-
elif digits_only.match(value):
133-
value = int(value)
132+
elif value[0] is '=' and digits_only.match(value[1:]):
133+
value = int(value[1:])
134134
elif value[0] is '[' and value[-1] is ']':
135135
value = value[1:-1].split(',')
136136
params[tag] = value

0 commit comments

Comments
 (0)