Create portable custom commands and scripts.
This is currently in beta, but usable.
All the config are located in $USER/.alfred/alfred.toml
[variables]
mode="debug"
[function.branch]
exec="git rev-parse --abbrev-ref HEAD"
[command.st]
exec="git status"
[command.cc]
exec="git commit -a {@}"
[command.push]
exec="git push {@}"
[command.b]
exec="echo {branch()}"
[command.pythonCall]
exec="~/.alfred/myscript.py::myFunction"
type="python"
$ alfred st
$ al cc
Variables are predefined values that can be injected in commands and functions
Example:
[variables]
mode="debug"
[command.print]
exec="echo {mode}"
Predefined commands that will be executed by Alfred
Commands are defined like this
[command.COMMAND_NAME]
exec="EXECUTION_LINE"
type="shell"
format=true
echo=false
help="HELP INFO"
Where: - COMMAND_NAME is the alias that Alfred will use to identify that command in the cli
- EXECUTION_LINE is the code that will be called. Alfred accepts multiline entries, which
will be wrapped in a script file and executed with the default shell executor.
- type the type of the command. Alfred currently accepts shell and python command types
- format marks if the instance should apply the formatter in the exec line or not.
If false, the placeholders {} will not be interpreted
- echo marks if the instance should print the command that will be executed before executing it
- help a descriptive message that will be showed in alfred @list
Functions can be created to enhance command execution during format time and are defined like this:
[function.FUNCTION_NAME]
exec="EXECUTION_LINE"
format=true
Where:
- FUNCTION_NAME is the alias that Alfred will use to identify that function in the formatter
- EXECUTION_LINE is the code that will be called. Currently Alfred only accepts one-line shell commands in functions.
- format marks if the instance should apply the formatter in the exec line or not.
If false, the placeholders {} will not be interpreted
- al[fred] @help Show help
- al[fred] @list List all commands
- al[fred] @version Show version
To install Alfred, run this command in your terminal:
$ pip install alfredcmd
This is the preferred method to install Alfred, as it will always install the most recent stable release.
If you don't have pip installed, this Python installation guide can guide you through the process.
The sources for Alfred can be downloaded from the Github repo.
You can either clone the public repository:
$ git clone git://github.com/GustavoKatel/alfredcmd
Or download the tarball:
$ curl -OL https://github.com/GustavoKatel/alfredcmd/tarball/master
Once you have a copy of the source, you can install it with:
$ python setup.py install
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.