Skip to content

Commit 683841a

Browse files
committed
pwclient: Add 'check-info' command
Get information about a given check. Signed-off-by: Stephen Finucane <[email protected]> Tested-by: Andy Doan <[email protected]>
1 parent 81d8a75 commit 683841a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

patchwork/bin/pwclient

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,15 @@ def action_check_list(rpc):
247247
check['patch']))
248248

249249

250+
def action_check_info(rpc, check_id):
251+
check = rpc.check_get(check_id)
252+
s = "Information for check id %d" % (check_id)
253+
print(s)
254+
print('-' * len(s))
255+
for key, value in sorted(check.items()):
256+
print("- %- 14s: %s" % (key, unicode(value).encode("utf-8")))
257+
258+
250259
def action_check_create(rpc, patch_id, context, state, url, description):
251260
try:
252261
rpc.check_create(patch_id, context, state, url, description)
@@ -485,6 +494,15 @@ def main():
485494
help='''List all checks'''
486495
)
487496
check_list_parser.set_defaults(subcmd='check_list')
497+
check_info_parser = subparsers.add_parser(
498+
'check-info',
499+
add_help=False,
500+
help='''Show information for a given check'''
501+
)
502+
check_info_parser.set_defaults(subcmd='check_info')
503+
check_info_parser.add_argument(
504+
'check_id', metavar='ID', action='store', type=int,
505+
help='Check ID',)
488506
check_create_parser = subparsers.add_parser(
489507
'check-create', parents=[hash_parser], conflict_handler='resolve',
490508
help='Add a check to a patch')
@@ -772,6 +790,10 @@ def main():
772790
elif action == 'check_list':
773791
action_check_list(rpc)
774792

793+
elif action == 'check_info':
794+
check_id = args['check_id']
795+
action_check_info(rpc, check_id)
796+
775797
elif action == 'check_create':
776798
for patch_id in non_empty(h, patch_ids):
777799
action_check_create(

0 commit comments

Comments
 (0)