diff --git a/_home/dot_sz.shrc.d/10_bin.path b/_home/dot_sz.shrc.d/10_bin.path deleted file mode 100644 index d75f257..0000000 --- a/_home/dot_sz.shrc.d/10_bin.path +++ /dev/null @@ -1,9 +0,0 @@ -# set PATH so it includes user's private bin if it exists -if [[ -d "$HOME/bin" ]] ; then - export PATH="~/bin:$PATH" -fi - -# set PATH so it includes user's private bin if it exists -if [[ -d "$HOME/.local/bin" ]] ; then - export PATH="~/.local/bin:$PATH" -fi diff --git a/_home/dot_sz.shrc.d/10_path.env b/_home/dot_sz.shrc.d/10_path.env new file mode 100644 index 0000000..6f95470 --- /dev/null +++ b/_home/dot_sz.shrc.d/10_path.env @@ -0,0 +1,18 @@ +get_clean_path() { + sed 's/ *:\?$//g;s/`/``/g;s/:/`:`/g;s/\\`:`/\\:/g;' <<< $1 | \ + awk -v RS='`:`' -v ORS='`:`' '!arr[$0]++' | \ + sed 's/`:`/:/g;s/:$//g' +} + +# set PATH so it includes user's private bin if it exists +if [[ -d "$HOME/bin" ]] ; then + export PATH="$HOME/bin:$PATH" +fi + +# set PATH so it includes user's private bin if it exists +if [[ -d "$HOME/.local/bin" ]] ; then + export PATH="$HOME/.local/bin:$PATH" +fi + +PATH=$( get_clean_path $PATH ) + diff --git a/_home/dot_sz.shrc.d/35_docker_aliases b/_home/dot_sz.shrc.d/35_docker_aliases new file mode 100644 index 0000000..2f887b1 --- /dev/null +++ b/_home/dot_sz.shrc.d/35_docker_aliases @@ -0,0 +1,3 @@ +if [[ -n "$(which-command docker)" ]]; then + alias dco="docker compose " +fi diff --git a/_home/dot_sz.shrc.d/bash.post/99_docker_compose.complete b/_home/dot_sz.shrc.d/bash.post/99_docker_compose.complete new file mode 100644 index 0000000..3837ab6 --- /dev/null +++ b/_home/dot_sz.shrc.d/bash.post/99_docker_compose.complete @@ -0,0 +1,17 @@ +if [[ -n "$BASH_COMPLETION_EXIST" && -n $(which-command docker-compose) ]]; then + # Function below is from https://stackoverflow.com/a/55668486/799379 + function _delegate_docker_compose() { + local cur subs + cur="${COMP_WORDS[COMP_CWORD]}" # partial word, if any + subs="compose" + if [[ $COMP_CWORD == 2 ]]; then + # Two whole words before the cursor - delegate to the second arg + _command $2 + else + # complete with the list of subcommands + COMPREPLY=( $(compgen -W "${subs}" -- ${cur}) ) + fi + } + + # echo "NOT Running: 'complete -F _delegate_docker_compose docker'" +fi