Skip to content

CLI

When you start Fabric (using the Application.run() method), Fabric will fire the GTK main loop and start a DBus client, which allows you to execute code on-the-fly and get information about your configuration file. Fabric grabs your global and local environment so when you run code via the DBus interface you get access to all of your variables, objects, and/or modules.

The CLI utility is just a command line tool to use the DBus interface instead of dealing with DBus communications yourself.

Usage

Usage: python -m fabric [OPTIONS] COMMAND [ARGS] ...
Options:
--help Show this message and exit.
Commands:
evaluate evaluate a python code within a running fabric instance and return the result
execute executes a python code within the running fabric instance
list-all list all currently running fabric instances

Examples

$ python -m fabric list-all
my-bar: /home/homan/.config/fabric/config.py
$ python -m fabric list-all -j # json serialization
{'instances-dbus-names': ['org.Fabric.fabric.my-bar']}
$ python -m fabric execute my-bar "bar.hide()" -j # executing python code
$ python -m fabric evaluate my-bar "bar.this_method_does_not_exist()" # should return an error
exception: AttributeError("'StatusBar' object has no attribute 'this_method_does_not_exist'")