See https://github.com/alephzero/alephzero for details
See https://github.com/alephzero/playground for examples.
pip install alephzero
import a0
p = a0.Publisher("topic")
p.pub("msg")
import a0
s = a0.Subscriber("topic", lambda pkt: print(pkt.payload))
Publish a message:
a0 pub topic msg
Subscribe to a topic:
a0 sub topic
Get more info:
a0 --help
Get more info for a command:
a0 cfg --help
Add the following snippet to your ~/.bashrc
:
eval "$(_A0_COMPLETE=bash_source a0)"
$ a0 <TAB><TAB>
cfg log prpc pub pubsub rpc sub
$ a0 cfg <TAB><TAB>
clear echo ls set
The a0
script searches for command plugins in three places:
- pip installed entry-points with key
a0.cli.cmds
~/.config/alephzero/cli/cmds/
env[A0_CLI_CMDS_PATH]
With (2) and (3), any python file in the path is expected to be a command file. The name of the file is the name of the command, for example foo.py
will be triggered by the command line a0 foo
. The file should export a symbol called cli
which is either a click.command
or click.group
.
env[A0_CLI_CMDS_PATH]
supports a colon separated list of paths.