You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 18, 2019. It is now read-only.
# Eg treat "-p complete=true" as {"complete": True}
218
-
forkey, valueinparams.items():
212
+
forfield, datainvalue:
219
213
try:
220
-
value=json.loads(value)
214
+
pair=(field, json.loads(data))
221
215
except:
222
-
pass
223
-
else:
224
-
params[key] =value
216
+
raiseclick.BadParameter('Invalid JSON for data argument "%s"'%field)
217
+
ret.append(pair)
225
218
226
-
returnparams
219
+
returnret
227
220
228
221
229
-
@click.command(help='Interact with the active document.\n\nRequires a PATH to a link in the document.')
222
+
@click.command(help='Interact with the active document.\n\nRequires a PATH to a link in the document.\n\nExample:\n\ncoreapi action users add_user --str username tom --data is_admin true')
230
223
@click.argument('path', nargs=-1)
231
-
@click.option('--param', '-p', multiple=True, callback=validate_params, help='Parameter in the form <field name>=<value>.')
232
-
@click.option('--action', '-a', help='Set the link action explicitly.', default=None)
233
-
@click.option('--transform', '-t', help='Set the linke transform explicitly.', default=None)
234
-
defaction(path, param, action, transform):
224
+
@click.option('strings', '--str', '-s', type=(unicode, unicode), multiple=True, metavar="FIELD STRING", help='String parameter for the action.')
225
+
@click.option('data', '--data', '-d', type=(unicode, unicode), multiple=True, callback=parse_json, metavar="FIELD DATA", help='Data parameter for the action.')
226
+
@click.option('files', '--file', '-f', type=(unicode, click.File('rb')), multiple=True, metavar="FIELD FILENAME", help='File parameter for the action.')
227
+
@click.option('--action', '-a', metavar="ACTION", help='Set the link action explicitly.', default=None)
228
+
@click.option('--encoding', '-e', metavar="ENCODING", help='Set the link encoding explicitly.', default=None)
229
+
@click.option('--transform', '-t', metavar="TRANSFORM", help='Set the link transform explicitly.', default=None)
0 commit comments