Alois Mahdal 10 lat temu
rodzic
commit
8c65f13616
8 zmienionych plików z 36 dodań i 36 usunięć
  1. 3
    3
      INSTALL.md
  2. 16
    16
      README
  3. 5
    5
      include/sardine.py
  4. 2
    2
      plugins/dump.py
  5. 2
    2
      plugins/echo.py
  6. 2
    2
      plugins/moc.py
  7. 2
    2
      plugins/sh.py
  8. 4
    4
      sardine

+ 3
- 3
INSTALL.md Wyświetl plik

@@ -1,8 +1,8 @@
1 1
 INSTALL
2 2
 =======
3 3
 
4
-Currently gmon is in heavy development state, so there is no "official"
4
+Currently sardine is in heavy development state, so there is no "official"
5 5
 installaion procedure.
6 6
 
7
-However, all that should suffice is to add *gmon/include* path to your
8
-**PYTHONPATH** and you should be able to run the *gmon/gmon* script.
7
+However, all that should suffice is to add *sardine/include* path to your
8
+**PYTHONPATH** and you should be able to run the *sardine/sardine* script.

+ 16
- 16
README Wyświetl plik

@@ -1,5 +1,5 @@
1
-GMON
2
-====
1
+SARDINE
2
+=======
3 3
 
4 4
 Generic plugin-based monitor, mainly for use with Xfce genmon
5 5
 
@@ -9,13 +9,13 @@ Generic plugin-based monitor, mainly for use with Xfce genmon.
9 9
 SYNOPSIS
10 10
 --------
11 11
 
12
-    gmon [options] command [args...]
12
+    sardine [options] command [args...]
13 13
 
14 14
 
15 15
 DESCRIPTION
16 16
 -----------
17 17
 
18
-gmon is a plugin-based "pretty-printer" that allows adding own sub-commands
18
+sardine is a plugin-based "pretty-printer" that allows adding own sub-commands
19 19
 and use them with common interface.
20 20
 
21 21
 Typical use case is when you have a space where only limited number of characters
@@ -27,7 +27,7 @@ Apart from that, the plugin can define other modes of output that might suit
27 27
 other targets better.  For example, genmon Xfce plugin is able to periodically
28 28
 display output of a command in desktop panel.  Apart from displaying simple
29 29
 string, it can parse XML-like content and use it to display tooltip or an icon.
30
-You could implement mode in your plugin for this target, and use gmon both for
30
+You could implement mode in your plugin for this target, and use sardine both for
31 31
 your Xfce panel and your terminal in a consistent manner.
32 32
 
33 33
 
@@ -65,22 +65,22 @@ of basic concept or as examples of how to implement your own plugin.
65 65
 This one takes first argument as a command name and runs it as a new process,
66 66
 passing the rest of arguments to it untouched:
67 67
 
68
-    $ gmon sh uname -a
68
+    $ sardine sh uname -a
69 69
     Linux fullmoon.brq.redhat.com 3.13.6-...
70
-    $ gmon sh who
70
+    $ sardine sh who
71 71
     somebody  tty1         2014-03-28 19:...
72 72
 
73 73
 Note that arguments are untouched, so things like wildcards/glubs will not
74
-work (unless the shell where you type the `gmon` command expands them).
74
+work (unless the shell where you type the `sardine` command expands them).
75 75
 
76 76
 
77 77
 ### echo ###
78 78
 
79 79
 Connects the arguments and prints them:
80 80
 
81
-    $ gmon echo hello
81
+    $ sardine echo hello
82 82
     hello
83
-    $ gmon echo "one two"   "three"
83
+    $ sardine echo "one two"   "three"
84 84
     one twothree
85 85
 
86 86
 
@@ -88,9 +88,9 @@ Connects the arguments and prints them:
88 88
 
89 89
 Dumps the arguments as Python sees them (using repr() builtin)
90 90
 
91
-    $ gmon dump "one two"   "three"
91
+    $ sardine dump "one two"   "three"
92 92
     args = ['one two', 'three']
93
-    $ gmon dump uname -a
93
+    $ sardine dump uname -a
94 94
     args = ['uname', '-a']
95 95
 
96 96
 
@@ -100,20 +100,20 @@ FILES
100 100
 *plugins*
101 101
   folder where plugins are stored
102 102
 
103
-*/etc/gmon/config*
103
+*/etc/sardine/config*
104 104
   system-wide configuration file
105 105
 
106
-*~/.config/gmon/config*
106
+*~/.config/sardine/config*
107 107
   user's personal config
108 108
 
109
-*~/.local/share/gmon/plugins/<plugin_name>*
109
+*~/.local/share/sardine/plugins/<plugin_name>*
110 110
   plugin local storage (if needed)
111 111
 
112 112
 
113 113
 ENVIRONMENT
114 114
 -----------
115 115
 
116
-`GMON_PLUGINS`
116
+`SARDINE_PLUGINS`
117 117
   Alternate folder for plugins
118 118
 
119 119
 

include/gmon.py → include/sardine.py Wyświetl plik

@@ -5,7 +5,7 @@ import os
5 5
 import sys
6 6
 
7 7
 
8
-class GmonPluginError(Exception):
8
+class SardinePluginError(Exception):
9 9
     pass
10 10
 
11 11
 
@@ -37,7 +37,7 @@ class BasePlugin(object):
37 37
         method_n = "render_" + self.data.fmt
38 38
 
39 39
         def ex(__):
40
-            raise GmonPluginError("method not defined: " + method_n)
40
+            raise SardinePluginError("method not defined: " + method_n)
41 41
 
42 42
         render_fn = getattr(self, method_n, ex)
43 43
         return render_fn()
@@ -80,7 +80,7 @@ class Subcommand(object):
80 80
                 module = imp.load_module(self.name, fh, modpath,
81 81
                                          (".py", "r", imp.PY_SOURCE))
82 82
         except IOError:
83
-            raise GmonPluginError(self.name)
83
+            raise SardinePluginError(self.name)
84 84
         self.plugin = module.Plugin(self.plugindata)
85 85
 
86 86
     def _format_output(self, raw):
@@ -102,13 +102,13 @@ class App:
102 102
         self._set_pluginpath()
103 103
         try:
104 104
             self.subcommand = Subcommand(cmdargs, self.pluginpath)
105
-        except GmonPluginError as e:
105
+        except SardinePluginError as e:
106 106
             self.die("no such plugin: %s" % e)
107 107
 
108 108
     def _set_pluginpath(self):
109 109
         mypath = os.path.dirname(os.path.realpath(sys.argv[0]))
110 110
         path = mypath + "/plugins"
111
-        path = os.environ.get("GMON_PLUGINS", path)
111
+        path = os.environ.get("SARDINE_PLUGINS", path)
112 112
         self.pluginpath = path
113 113
 
114 114
     def die(self, msg, rv=9):

+ 2
- 2
plugins/dump.py Wyświetl plik

@@ -1,9 +1,9 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 
3
-import gmon
3
+import sardine
4 4
 
5 5
 
6
-class Plugin(gmon.BasePlugin):
6
+class Plugin(sardine.BasePlugin):
7 7
 
8 8
     def render_plain(self):
9 9
         out = "args = %s" % repr(self.args)

+ 2
- 2
plugins/echo.py Wyświetl plik

@@ -1,9 +1,9 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 
3
-import gmon
3
+import sardine
4 4
 
5 5
 
6
-class Plugin(gmon.BasePlugin):
6
+class Plugin(sardine.BasePlugin):
7 7
 
8 8
     def render_plain(self):
9 9
         out = "".join([str(s) for s in self.data.args])

+ 2
- 2
plugins/moc.py Wyświetl plik

@@ -1,6 +1,6 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 
3
-import gmon
3
+import sardine
4 4
 
5 5
 import subprocess
6 6
 
@@ -60,7 +60,7 @@ class MocTitler(object):
60 60
             return "(not running)"
61 61
 
62 62
 
63
-class Plugin(gmon.BasePlugin):
63
+class Plugin(sardine.BasePlugin):
64 64
 
65 65
     name = "moc"
66 66
 

+ 2
- 2
plugins/sh.py Wyświetl plik

@@ -2,10 +2,10 @@
2 2
 
3 3
 import subprocess
4 4
 
5
-import gmon
5
+import sardine
6 6
 
7 7
 
8
-class Plugin(gmon.BasePlugin):
8
+class Plugin(sardine.BasePlugin):
9 9
 
10 10
     def render_plain(self):
11 11
         return subprocess.check_output(self.args)

gmon → sardine Wyświetl plik

@@ -2,7 +2,7 @@
2 2
 
3 3
 """Generic mon echoer
4 4
 
5
-usage: gmon [options] COMMAND [ARGS...]
5
+usage: sardine [options] COMMAND [ARGS...]
6 6
 
7 7
 Options:
8 8
     -c, --chars CHARS specify limit in characters
@@ -15,13 +15,13 @@ Options:
15 15
 """
16 16
 
17 17
 import docopt
18
-import gmon
18
+import sardine
19 19
 
20 20
 
21 21
 if __name__ == '__main__':
22 22
 
23 23
     args = docopt.docopt(__doc__,
24
-                         version="gmon 0.1",
24
+                         version="sardine 0.1",
25 25
                          options_first=True)
26
-    app = gmon.App(args)
26
+    app = sardine.App(args)
27 27
     app.run()