From 5b3b5c5f8a724a124a572b6b05990d4588b2c705 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 4 Jul 2018 15:43:02 +0300 Subject: Add: icktool get-artifact subcommand --- icktool | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'icktool') diff --git a/icktool b/icktool index 39def14..5329fd2 100755 --- a/icktool +++ b/icktool @@ -148,6 +148,10 @@ class Icktool(cliapp.Application): cmd = self._command(ShowLatestLogCommand) cmd.execute(args) + def cmd_get_artifact(self, args): + cmd = self._command(GetArtifactCommand) + cmd.execute(args) + def _command(self, klass): api = self._new_api() token = self._new_token(api) @@ -487,4 +491,15 @@ class ShowLatestLogCommand(Command): return None +class GetArtifactCommand(Command): + + def execute(self, args): + if not args: + raise Exception('Must give blob id as argument') + blob_id = args[0] + path = '/blobs/{}'.format(blob_id) + blob = self.api.show_blob(path) + sys.stdout.buffer.write(blob) + + Icktool(version=ick2.__version__).run() -- cgit v1.2.1