-
-
Save briandconnelly/95079e5b356efe5dcb49c1c5511747af to your computer and use it in GitHub Desktop.
Basic Bash completion for Airflow
This file contains 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
_airflow() | |
{ | |
local cur prev opts base | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
# echo $prev | |
# | |
# The basic options we'll complete. | |
# | |
opts="flower pause resetdb upgradedb render | |
task_failed_deps backfill task_state list_tasks | |
clear worker version initdb dag_state connections | |
serve_logs list_dags test pool trigger_dag | |
variables run scheduler webserver unpause kerberos" | |
# | |
# Complete the arguments to some of the basic commands. | |
# | |
case "${prev}" in | |
backfill|list_tasks|clear|pause|unpause|trigger_dag|render|run|dag_state|task_failed_deps|task_state|test) | |
local dags=$(for x in `airflow list_dags | | |
sed -z -n -e 's/^.*\(---\)//p'`; do echo $x; done) | |
COMPREPLY=( $(compgen -W "${dags}" -- ${cur}) ) | |
return 0 | |
;; | |
*) | |
;; | |
esac | |
COMPREPLY=( $( compgen -W "$opts" -- $cur)) | |
return 0 | |
} | |
complete -F _airflow airflow |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment