diff options
author | tv <tv@nomic.retiolum> | 2013-12-18 22:15:38 +0100 |
---|---|---|
committer | tv <tv@nomic.retiolum> | 2013-12-18 22:15:38 +0100 |
commit | e152f84b84b348070ca31e34c65bc54f07af8b8b (patch) | |
tree | d1cdd710ccf798353bba60689bb5d140823524b8 /Reaktor/commands | |
parent | d62b233846053c67b4616d43ff834d99ce02cbb6 (diff) |
Reaktor: caps show all commands w/capname prop
Diffstat (limited to 'Reaktor/commands')
-rwxr-xr-x | Reaktor/commands/caps | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/Reaktor/commands/caps b/Reaktor/commands/caps index caa1fe06..eb1d97a6 100755 --- a/Reaktor/commands/caps +++ b/Reaktor/commands/caps @@ -1,5 +1,19 @@ -#! /bin/sh -exec echo 'TODO: need access to config.json' -set -euf -cd public_commands -echo `ls` +#! /usr/bin/env python +import imp +import os + +def load_config(filename): + dirname = os.path.dirname(filename) + modname, ext = os.path.splitext(os.path.basename(filename)) + file, pathname, description = imp.find_module(modname, [ dirname ]) + return imp.load_module(modname, file, pathname, description) + +def not_none(x): + return x != None + +def pluck(name): + return lambda x: name in x.keys() and x[name] or None + +config = load_config(os.environ['config_filename']) + +print(' '.join(filter(not_none, map(pluck('capname'), config.irc_commands)))) |