Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: client/swarming.py

Issue 2694183003: Fix ./swarming.py query-list. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/swarming.py
diff --git a/client/swarming.py b/client/swarming.py
index 90552540bdeec72e384b61b641e4fff22a66eccd..24743a5a632e6b1e5e7fa6d41280623b8d539864 100755
--- a/client/swarming.py
+++ b/client/swarming.py
@@ -5,7 +5,7 @@
"""Client tool to trigger tasks or retrieve results from a Swarming server."""
-__version__ = '0.8.9'
+__version__ = '0.8.10'
import collections
import datetime
@@ -15,6 +15,7 @@ import optparse
import os
import subprocess
import sys
+import textwrap
import threading
import time
import urllib
@@ -1408,18 +1409,35 @@ def CMDquery_list(parser, args):
help_url = (
'https://apis-explorer.appspot.com/apis-explorer/?base=%s/_ah/api#p/' %
options.swarming)
- for api_id, api in sorted(apis.iteritems()):
+ for i, (api_id, api) in enumerate(sorted(apis.iteritems())):
+ if i:
+ print('')
print api_id
- print ' ' + api['description']
- for resource_name, resource in sorted(api['resources'].iteritems()):
- print ''
- for method_name, method in sorted(resource['methods'].iteritems()):
+ print ' ' + api['description'].strip()
+ if 'resources' in api:
+ # Old.
+ for j, (resource_name, resource) in enumerate(
+ sorted(api['resources'].iteritems())):
+ if j:
+ print('')
+ for method_name, method in sorted(resource['methods'].iteritems()):
+ # Only list the GET ones.
+ if method['httpMethod'] != 'GET':
+ continue
+ print '- %s.%s: %s' % (
+ resource_name, method_name, method['path'])
+ print('\n'.join(
+ ' ' + l for l in textwrap.wrap(method['description'], 78)))
+ print ' %s%s%s' % (help_url, api['servicePath'], method['id'])
+ else:
+ # New.
+ for method_name, method in sorted(api['methods'].iteritems()):
# Only list the GET ones.
if method['httpMethod'] != 'GET':
continue
- print '- %s.%s: %s' % (
- resource_name, method_name, method['path'])
- print ' ' + method['description']
+ print '- %s: %s' % (method['id'], method['path'])
+ print('\n'.join(
+ ' ' + l for l in textwrap.wrap(method['description'], 78)))
print ' %s%s%s' % (help_url, api['servicePath'], method['id'])
return 0
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698