summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xicktool10
1 files changed, 10 insertions, 0 deletions
diff --git a/icktool b/icktool
index 34266d3..64b0793 100755
--- a/icktool
+++ b/icktool
@@ -286,6 +286,12 @@ class Command:
self.api = api
self.output = output
+ def _check_for_leading_slash(self, args):
+ for arg in args:
+ if not arg.startswith('/'):
+ raise Exception(
+ 'Argument should start with slash: {}'.format(arg))
+
def _prettyson(self, obj):
json.dump(obj, self.output, indent=4, sort_keys=True)
self.output.write('\n')
@@ -446,6 +452,8 @@ class ShowCommand(Command):
'/projects',
'/pipelines',
]
+ else:
+ self._check_for_leading_slash(args)
for what in args:
objs = self.api.show(what)
@@ -455,6 +463,7 @@ class ShowCommand(Command):
class DeleteCommand(Command):
def execute(self, args):
+ self._check_for_leading_slash(args)
for what in args:
self.api.delete(what)
@@ -462,6 +471,7 @@ class DeleteCommand(Command):
class ShowLogCommand(Command):
def execute(self, args):
+ self._check_for_leading_slash(args)
for log_id in args:
log = self.api.show_blob(log_id)
log = log.decode('UTF-8')