This workflow enable Alfred to execute alias or functions that come from ~/.profile, ~/.zprofile, ~/.bash_profile and ~/my_bash/profile.sh (Common bash profile alias and functions template) in background, and display output to alfred large type and notification.
Download and install the workflow in alfred.
Type >
The workflow will auto display alias and functions from profiles. E.g.
The workflow scan bash profile, and display aliases and functions automatically. You can add description and arguments hint manually before each aliases or functions in profile file as following:
#Find a command in your grep history
#var: file name
his () { history | grep "$@" ; }
You may need to add comment tags for your alias or functions in profiles for alfred to read with following format:
#alfred; command: XXX ; parameters: XXX or 'none', ('none' means no parameter); description: XXX
Where keyword
'command' is alias or function name.
'parameters' is alias or function parameters. If it doesn't have parameters, you need to give 'none'.
'description' is alias or function description.
- If there has duplicate alias or function names, Alfred only display first one.
- Custom comment tag has higher priority then alias and functions.
- Support display recommendations from keyword in camelcase, underscore and hyphen.
- Add comment and parameter hint in alias functions as following:
# Moves a file to the MacOS trash # parameters: path (or var: path | none) trash () { command mv "$@" ~/.Trash ; }
- Can define function parameters as 'parameters:', 'var:', 'parameter'. If function parameter contain 'none', so it will not require to have parameter.
- Start with _ for ignoring indexing in alfred. E.g. Inner function.
In workflow source folder, run command:
# display alfred workflow output
php run.php help
# run some tests
php test.php