Skip to content

Commit c65c2dc

Browse files
committed
added 'list' values and wildcards in translation keys
1 parent ac2066d commit c65c2dc

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ The `-sock` option specifies a path to a unix socket that other programs can con
4747

4848
Both `-kvfile` and `-sock` support special name-value pairs whose name begins with '@'. These are treated as counters, so that instead of storing the sent value, the counter increments. If a blank string is sent as the value, the counter will reset to zero.
4949

50+
Both `-kvfile` and `-sock` support special name-value pairs whose name begins with '>'. These work like the counters above, but in addition are stored as lists in files at '~/.barmaid/<name>.lst'. An on-click can then be used to launch some program that will display the list. If a blank string is sent as the value the counter will reset to zero and the list will be cleared.
51+
5052
Finally the `format string` is the string to display. Values within `$()` will be substituted by the program with the appropriate data, like this:
5153

5254
```
@@ -203,7 +205,9 @@ Where 'name' is the name of a value, and 'value' is it's actual displayed result
203205
up:google.com:80=up|~gG~0
204206
```
205207

206-
Could be used to supply a green 'G' to indicate google is accessible, but not interfere with any other values that return 'up'
208+
Could be used to supply a green 'G' to indicate google is accessible, but not interfere with any other values that return 'up'.
209+
210+
The 'key' of the translation (i.e. 'name=value') can contain shell/fnmatch-style wildcards. The symbols '*', '+', '?', '[' and ']' will be honored with their shell/fnmatch meanings. '\' can be used to quote these characters.
207211

208212
EXAMPLE:
209213

barmaid.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ SHELL_OKAY=0
1111
SHELL_CLOSED=1
1212
SHELL_CLS=2
1313

14-
version="5.1"
14+
version="5.2"
1515
settings={}
1616
lookup_counter=0
1717
lookup_values={}
@@ -251,7 +251,7 @@ end
251251

252252
translations.add=function(self, pattern, value)
253253

254-
if string.find(pattern, "*") ~= nil
254+
if string.find(pattern, "[*+?%[%]]") ~= nil
255255
then
256256
self.by_pattern[pattern]=value
257257
else

0 commit comments

Comments
 (0)