From 5f8e60e03ab8116fa9cb01da1131b37fa5065e20 Mon Sep 17 00:00:00 2001 From: Flo Date: Sat, 21 Dec 2024 15:49:15 +0100 Subject: [PATCH] completion --- bin/dcom | 16 +++++++++++++++- bin/drun | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/bin/dcom b/bin/dcom index b58f642..e7cce27 100644 --- a/bin/dcom +++ b/bin/dcom @@ -60,4 +60,18 @@ dcom() { if [[ -f "$SYSTEM_ENV_FILE" ]] ; then unset $(grep -v '^#' "$SYSTEM_ENV_FILE" | sed -E 's/(.*)=.*/\1/' | xargs) fi -} \ No newline at end of file +} + +_dcom_completion() { + local SYSTEMS_CONFIG="$ENV_DIR/.systems" + local cur prev opts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="$(awk '{print $1}' $SYSTEMS_CONFIG | paste -sd' ' -)" + + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 +} + +complete -F _dcom_completion dcom \ No newline at end of file diff --git a/bin/drun b/bin/drun index 97d45d2..7f7cf9e 100644 --- a/bin/drun +++ b/bin/drun @@ -73,4 +73,18 @@ drun() { docker exec "$CONTAINER_ID" $DOCKER_EXEC_COMMAND fi fi -} \ No newline at end of file +} + +_drun_completion() { + local SYSTEMS_CONFIG="$ENV_DIR/.systems" + local cur prev opts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="$(awk '{print $1}' $SYSTEMS_CONFIG | paste -sd' ' -)" + + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 +} + +complete -F _drun_completion drun \ No newline at end of file