Ver código fonte

Make docopt more readable

Alois Mahdal 10 anos atrás
pai
commit
3a44c28eb3
2 arquivos alterados com 7 adições e 7 exclusões
  1. 4
    4
      gmon
  2. 3
    3
      include/gmon.py

+ 4
- 4
gmon Ver arquivo

@@ -2,12 +2,12 @@
2 2
 
3 3
 """Generic mon echoer
4 4
 
5
-usage: gmon [--format=<format>] [-p|--plain] [-x|--xgp] <command> [<args>...]
5
+usage: gmon [options] COMMAND [ARGS...]
6 6
 
7 7
 Options:
8
-    -c, --chars     specify limit in characters
9
-    --format <format>   specify format: plain is a plain text, xgp
10
-                        is specific for xfce4-genmon-plugin
8
+    -c, --chars CHARS specify limit in characters
9
+    --format FMT    specify format: plain is a plain text, xgp
10
+                    is specific for xfce4-genmon-plugin
11 11
     -p, --plain     same as --format=plain
12 12
     -x, --xgp       same as --format=xgp
13 13
     -h, --help      show this screen

+ 3
- 3
include/gmon.py Ver arquivo

@@ -60,8 +60,8 @@ class PluginData(object):
60 60
             self.fmt = "plain"
61 61
         elif cmdargs['--xgp']:
62 62
             self.fmt = "xgp"
63
-        self.name = cmdargs['<command>']
64
-        self.args = cmdargs['<args>']
63
+        self.name = cmdargs['COMMAND']
64
+        self.args = cmdargs['ARGS']
65 65
         if cmdargs['--chars']:
66 66
             self.maxlen = int(cmdargs['--chars'])
67 67
 
@@ -70,7 +70,7 @@ class Subcommand(object):
70 70
 
71 71
     def __init__(self, cmdargs, pluginpath):
72 72
         self.plugindata = PluginData(cmdargs)
73
-        self.name = cmdargs['<command>']
73
+        self.name = cmdargs['COMMAND']
74 74
         self._load_plugin(pluginpath)
75 75
 
76 76
     def _load_plugin(self, pluginpath):