Switched view back to previous argument format (viewer is an optional argument without a flag)
authorDmitriy Morozov <dmitriy@mrzv.org>
Wed, 02 Sep 2009 16:49:05 -0700
changeset 24 0372fd85c93d
parent 23 13d0fa15a6b5
child 25 a7e31159efb9
Switched view back to previous argument format (viewer is an optional argument without a flag)
alexandria.py
--- a/alexandria.py	Wed Sep 02 16:44:54 2009 -0700
+++ b/alexandria.py	Wed Sep 02 16:49:05 2009 -0700
@@ -100,9 +100,9 @@
     session.commit()
     _show_paper(p)
  
-@command([('v', 'viewer', '', 'viewer to use')] + dbopts,
-         usage = '%name [-v VIEWER] HASH')
-def view(cfg, hash, **opts):
+@command(dbopts,
+         usage = '%name HASH [VIEWER]')
+def view(cfg, hash, viewer = None, **opts):
     """View paper by hash"""
 
     p = Paper.query.filter(Paper.md5.startswith(hash)).all()
@@ -118,7 +118,7 @@
     else:
         p = p[0]
     
-    viewer = opts['viewer'] or cfg['default_viewer']
+    viewer = viewer or cfg['default_viewer']
     os.system('%s %s' % (viewer, os.path.join(cfg['commonpath'], p.path.strip('/'))))
     
 @command(dbopts,