diff --git a/.bash_profile b/.bash_profile index 06c8d69..50d0553 100644 --- a/.bash_profile +++ b/.bash_profile @@ -5,10 +5,10 @@ export XDG_STATE_HOME="$HOME/.local/state" export XDG_CONFIG_DIRS=/etc/xdg export XDG_DATA_DIRS="$XDG_DATA_HOME/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share" -HISTFILE="$XDG_STATE_HOME/bash_history" -HISTCONTROL=ignoreboth -HISTSIZE=65536 -SAVEHIST=8192 +export HISTFILE="$XDG_STATE_HOME/bash_history" +export HISTCONTROL=ignoreboth +export HISTSIZE=65536 +export SAVEHIST=8192 export LESSHISTFILE='-' diff --git a/.config/bash/11-git.bash b/.config/bash/11-git.bash index 3139cd5..dd6e4b2 100644 --- a/.config/bash/11-git.bash +++ b/.config/bash/11-git.bash @@ -1,5 +1,3 @@ function gi() { - local IFS=, - - curl -fL "https://www.toptal.com/developers/gitignore/api/$*" + curl -fL "https://www.toptal.com/developers/gitignore/api/$(printf '%s\n' "$@" | sort -u | paste -sd,)" } diff --git a/.local/share/bash-completion/completions/ddev b/.local/share/bash-completion/completions/ddev index c6db64e..aa10170 100644 --- a/.local/share/bash-completion/completions/ddev +++ b/.local/share/bash-completion/completions/ddev @@ -1,6 +1,10 @@ function _ddev() { - mapfile -t COMPREPLY < <(compgen -W \ - "$(curl -sfL 'https://api.github.com/repos/docker-library/official-images/git/trees/master?recursive=1' | sed -nE 's/.*"library\/(.+)",$/\1/p')" \ - -- "${COMP_WORDS[1]}") + cache="/tmp/${FUNCNAME[0]}" + + if ! [ -f "$cache" ]; then + curl -sfL 'https://api.github.com/repos/docker-library/official-images/git/trees/master?recursive=1' | sed -nE 's/.*"library\/(.+)",$/\1/p' > "$cache" + fi + [ "$COMP_CWORD" -ne 1 ] && return + mapfile -t COMPREPLY < <(compgen -W "$(cat "$cache")" -- "${COMP_WORDS[1]}") } complete -F _ddev ddev diff --git a/.local/share/bash-completion/completions/gi b/.local/share/bash-completion/completions/gi index 17bb830..71cf315 100644 --- a/.local/share/bash-completion/completions/gi +++ b/.local/share/bash-completion/completions/gi @@ -1,6 +1,9 @@ function _gi() { - mapfile -t COMPREPLY < <(compgen -W \ - "$(curl -sfL https://www.toptal.com/developers/gitignore/api/list | tr ',' '\n')" \ - -- "${COMP_WORDS[1]}") + cache="/tmp/${FUNCNAME[0]}" + + if ! [ -f "$cache" ]; then + curl -sfL https://www.toptal.com/developers/gitignore/api/list | tr ',' '\n' > "$cache" + fi + mapfile -t COMPREPLY < <(compgen -W "$(cat "$cache")" -- "${COMP_WORDS[$COMP_CWORD]}") } complete -F _gi gi