Skip to content

Commit

Permalink
added 'list' values and wildcards in translation keys
Browse files Browse the repository at this point in the history
  • Loading branch information
ColumPaget committed Dec 24, 2020
1 parent ac2066d commit c65c2dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ The `-sock` option specifies a path to a unix socket that other programs can con

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.

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.

Finally the `format string` is the string to display. Values within `$()` will be substituted by the program with the appropriate data, like this:

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

Could be used to supply a green 'G' to indicate google is accessible, but not interfere with any other values that return 'up'
Could be used to supply a green 'G' to indicate google is accessible, but not interfere with any other values that return 'up'.

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.

EXAMPLE:

Expand Down
4 changes: 2 additions & 2 deletions barmaid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SHELL_OKAY=0
SHELL_CLOSED=1
SHELL_CLS=2

version="5.1"
version="5.2"
settings={}
lookup_counter=0
lookup_values={}
Expand Down Expand Up @@ -251,7 +251,7 @@ end

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

if string.find(pattern, "*") ~= nil
if string.find(pattern, "[*+?%[%]]") ~= nil
then
self.by_pattern[pattern]=value
else
Expand Down

0 comments on commit c65c2dc

Please sign in to comment.