irc3.plugins.shell_command Shell commands

Allow to quickly add commands map to a shell command. The bot will print stdout/stderr

Usage:

>>> config = ini2config("""
... [bot]
... includes =
...     irc3.plugins.shell_command
... [irc3.plugins.shell_command]
... myscript = /tmp/myscript
... # optional command configuration
... myscript.permission = runmyscrypt
... myscript.public = false
... # register a directory
... myscripts = /tmp/myscripts
... # optional commands configuration for the directory
... myscripts.permission = runmyscrypts
... """)
>>> bot = IrcBot(**config)

Then the uname command will be available:

>>> bot.test(':gawel!user@host PRIVMSG irc3 :!help myscript')
PRIVMSG gawel :Run $ /tmp/myscript
PRIVMSG gawel :!myscript [<args>...]

>>> bot.test(':gawel!user@host PRIVMSG #chan :!myscript')
PRIVMSG gawel :You can only use the 'myscript' command in private.

>>> bot.test(':gawel!user@host PRIVMSG irc3 :!myscript')

If the user provides some arguments then those will be available as an environment var (to avoid shell injection) names IRC3_COMMAND_ARGS

>>> bot.get_plugin(Commands)['demo'][0]
{'permission': 'runmyscrypts'}