From 2fb6fd3069504014a06d32b526308844b6f06690 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 19 Nov 2017 21:07:07 +0100 Subject: Add: sort dict keys in JSON output --- icktool | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'icktool') diff --git a/icktool b/icktool index 64fbba0..8a04fe1 100755 --- a/icktool +++ b/icktool @@ -155,6 +155,16 @@ class Icktool(cliapp.Application): obj = json.loads(text) self._prettyson(obj) + def cmd_trigger(self, args): + project = args[0] + pipeline = args[1] + path = '/projects/{}/pipelines/{}/+trigger'.format(project, pipeline) + api = self._new_api() + code, text = api.get(path) + self._report(code, 200, text) + obj = json.loads(text) + self._prettyson(obj) + def cmd_list_workers(self, args): rc = self._new_rc('/workers', 'worker') self._prettyson(rc.list()) @@ -219,7 +229,7 @@ class Icktool(cliapp.Application): return ResourceCommands(path, api, field_name) def _prettyson(self, obj): - json.dump(obj, sys.stdout, indent=4) + json.dump(obj, sys.stdout, indent=4, sort_keys=True) sys.stdout.write('\n') def _read_object(self): -- cgit v1.2.1