diff --git a/.bash_completion.d/completions/aws-auth b/.bash_completion.d/completions/aws-auth new file mode 100755 index 0000000..eba07cd --- /dev/null +++ b/.bash_completion.d/completions/aws-auth @@ -0,0 +1,10 @@ +function _aws-auth { + if [ "${#COMP_WORDS[@]}" != "2" ]; then + return + fi + local aws_profiles + aws_profiles="$(pcre2grep -O '$1' '(?>\[\s*profile )(\S+)(?>\s*\])' ~/.aws/config)" + COMPREPLY=($(compgen -W "$aws_profiles" "${COMP_WORDS[$COMP_CWORD]}" )) +} + +complete -F _aws-auth aws-auth diff --git a/.environment.d/bash_completion.env b/.environment.d/bash_completion.env new file mode 100644 index 0000000..13c9c48 --- /dev/null +++ b/.environment.d/bash_completion.env @@ -0,0 +1 @@ +BASH_COMPLETION_USER_DIR="${HOME}/.bash_completion.d"