Anton Shestakov avatar Anton Shestakov committed f1625b8

Sort FIELDS on printing. Use single global set of fields in help message.

Comments (0)

Files changed (1)

     parser = OptionParser(
         usage='%prog [options] [search phrase]',
         description='Search videos on YouTube by specified search phrase.',
-        epilog='Fields: title, link, published, updated, favs, views, likes, dislikes. '
-               'Shorthand fields (t instead of title) are also valid unless ambiguous.')
+        epilog='Fields: %s. '
+               'Shorthand fields (t instead of title) are also valid unless ambiguous.'
+               % ', '.join(sorted(FIELDS)))
     
     parser.add_option('--fields', dest='fields', metavar='FIELD[,FIELD+]', type=str,
                 default='title,link', help='output specified fields in given order (default: title,link)')
     for request in options.fields.split(','):
         candidates = filter(lambda x: x.startswith(request), FIELDS)
         if not candidates:
-            print 'No such field "%s". Available fields: %s' % (request, ', '.join(FIELDS))
+            print 'No such field "%s". Available fields: %s' % (request, ', '.join(sorted(FIELDS)))
             parser.exit()
         elif len(candidates) > 1:
             print 'Field "%s" is ambiguous: %s' % (request, ', '.join(candidates))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.