diff mbox

[4/4] pwclient: Add 'check-info' command

Message ID 1456516490-15658-4-git-send-email-stephen.finucane@intel.com
State Accepted
Headers show

Commit Message

Stephen Finucane Feb. 26, 2016, 7:54 p.m. UTC
Get information about a given check.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
---
 patchwork/bin/pwclient | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Comments

Andy Doan Feb. 29, 2016, 5:29 p.m. UTC | #1
On 02/26/2016 01:54 PM, Stephen Finucane wrote:
> Get information about a given check.
>
> Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>

Tested-by: Andy Doan <andy.doan@linaro.org>
Stephen Finucane March 3, 2016, 2:47 p.m. UTC | #2
On 29 Feb 11:29, Andy Doan wrote:
> On 02/26/2016 01:54 PM, Stephen Finucane wrote:
> >Get information about a given check.
> >
> >Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
> 
> Tested-by: Andy Doan <andy.doan@linaro.org>

Merged.
diff mbox

Patch

diff --git a/patchwork/bin/pwclient b/patchwork/bin/pwclient
index 751aeed..f437786 100755
--- a/patchwork/bin/pwclient
+++ b/patchwork/bin/pwclient
@@ -247,6 +247,15 @@  def action_check_list(rpc):
                                       check['patch']))
 
 
+def action_check_info(rpc, check_id):
+    check = rpc.check_get(check_id)
+    s = "Information for check id %d" % (check_id)
+    print(s)
+    print('-' * len(s))
+    for key, value in sorted(check.items()):
+        print("- %- 14s: %s" % (key, unicode(value).encode("utf-8")))
+
+
 def action_check_create(rpc, patch_id, context, state, url, description):
     try:
         rpc.check_create(patch_id, context, state, url, description)
@@ -485,6 +494,15 @@  def main():
         help='''List all checks'''
     )
     check_list_parser.set_defaults(subcmd='check_list')
+    check_info_parser = subparsers.add_parser(
+        'check-info',
+        add_help=False,
+        help='''Show information for a given check'''
+    )
+    check_info_parser.set_defaults(subcmd='check_info')
+    check_info_parser.add_argument(
+        'check_id', metavar='ID', action='store', type=int,
+        help='Check ID',)
     check_create_parser = subparsers.add_parser(
         'check-create', parents=[hash_parser], conflict_handler='resolve',
         help='Add a check to a patch')
@@ -772,6 +790,10 @@  def main():
     elif action == 'check_list':
         action_check_list(rpc)
 
+    elif action == 'check_info':
+        check_id = args['check_id']
+        action_check_info(rpc, check_id)
+
     elif action == 'check_create':
         for patch_id in non_empty(h, patch_ids):
             action_check_create(