-
-
Save kovacshuni/b2d5ef3194f245c72b3c274a72db7b8a 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