aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Jani Nikula <jani@nikula.org>2013-04-01 12:44:01 +0300
committerGravatar David Bremner <bremner@debian.org>2013-04-06 08:36:26 -0300
commit73fcfa861cf412a548238fdf3e0a505d98d7ea78 (patch)
tree65097b0be6861a67528965750e76227d7b35c017
parent1c450ec5fab8ca985b4ee07460f233f032577fbc (diff)
nmbug-status: add support for querying the search views
Make it easy for scripts to read the views and corresponding searches.
-rwxr-xr-xdevel/nmbug/nmbug-status16
1 files changed, 14 insertions, 2 deletions
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index d08ca08d..55f0d738 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -13,6 +13,7 @@ import urllib
import json
import argparse
import os
+import sys
import subprocess
# parse command line arguments
@@ -20,9 +21,10 @@ import subprocess
parser = argparse.ArgumentParser()
parser.add_argument('--text', help='output plain text format',
action='store_true')
-
parser.add_argument('--config', help='load config from given file')
-
+parser.add_argument('--list-views', help='list views',
+ action='store_true')
+parser.add_argument('--get-query', help='get query for view')
args = parser.parse_args()
@@ -46,6 +48,16 @@ else:
config = json.load(fp)
+if args.list_views:
+ for view in config['views']:
+ print view['title']
+ sys.exit(0)
+elif args.get_query != None:
+ for view in config['views']:
+ if args.get_query == view['title']:
+ print ' and '.join(view['query'])
+ sys.exit(0)
+
if args.text:
output_format = 'text'
else: