Last active
August 3, 2016 11:33
-
-
Save tamas-molnar/6e0d26c14c9a48a2b8a0 to your computer and use it in GitHub Desktop.
aliases and shortcuts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias fc='fleetctl' | |
alias fclm='fleetctl list-machines' | |
alias fclu='fleetctl list-units' | |
alias fcjf='fleetctl journal -f ' | |
alias fcbad='fleetctl list-units | grep -v "exited\|running\|backup\|upgrade"' | |
function fclmg() { fleetctl list-machines | grep $@ ;} | |
function fclug() { fleetctl list-units | grep $@ ;} | |
function fcssh() { fleetctl ssh $@ ;} | |
function fcjfl() { fleetctl journal -f --lines=$@ ; } | |
function fcres() { fleetctl ssh $@ sudo systemctl restart $@ ; } | |
Add autocomplete functionality for some of the above functions: | |
Generate your list of services in a file on one line, separated by spaces: ~/services.list | |
Create file services_autocomplete.sh: | |
_services(){ | |
local cur=${COMP_WORDS[COMP_CWORD]} | |
COMPREPLY=( $(compgen -W "$(<~/services.list)" -- ${cur}) ) | |
} | |
complete -F _services fcres | |
complete -F _services fcjf | |
complete -F _services fcssh | |
Source file in your .bashrc | |
. ~/services_autocomplete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment