commit f654f9b4a52cb7f980eb5b7f4e0b71f007cedbba parent 7c27a9331780c2dc0ffebcffa9f05959fab126fe Author: Alexey Shiklomanov <ashiklom@bu.edu> Date: Tue, 3 Oct 2017 08:31:19 -0400 Tag API: Check tag API argument lengths Invalid argument length will result in a call to `usage`. Diffstat:
M | simplenote_cli/sncli.py | | | 6 | ++++++ |
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/simplenote_cli/sncli.py b/simplenote_cli/sncli.py @@ -1422,6 +1422,12 @@ def sncli_start(sync=sync, verbose=verbose, config=config): if not key: usage() + nargs = len(args) + correct_get = (args[1] == 'get' and nargs == 2) + correct_other = (args[1] in ['set', 'add', 'rm'] and nargs == 3) + if not (correct_get or correct_other): + usage() + if args[1] == 'get': sn = sncli_start()