diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-10-30 10:39:22 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-10-30 10:39:22 +1300 |
commit | ee7396c3eaba483ff950579c99d849d4c719ecb5 (patch) | |
tree | a20c0b1a1c756e317dca35ae07641192c43df5f6 | |
parent | Merge branch 'release/v1.70.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-ee7396c3eaba483ff950579c99d849d4c719ecb5.tar.gz dotfiles-ee7396c3eaba483ff950579c99d849d4c719ecb5.zip |
Merge branch 'release/v1.71.0'v1.71.0
* release/v1.71.0:
Bump VERSION
Documented the special install-conf target
Respect completion-ignore-case in custom functions
Use case statement for sudo -v switching
-rw-r--r-- | ISSUES.md | 3 | ||||
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | bash/bash_completion.d/eds.bash | 15 | ||||
-rw-r--r-- | bash/bash_completion.d/keep.bash | 15 | ||||
-rw-r--r-- | bash/bash_completion.d/man.bash | 14 | ||||
-rw-r--r-- | bash/bash_completion.d/mysql.bash | 14 | ||||
-rw-r--r-- | bash/bash_completion.d/pass.bash | 14 | ||||
-rw-r--r-- | bash/bash_completion.d/path.bash | 14 | ||||
-rw-r--r-- | bash/bash_completion.d/sd.bash | 14 | ||||
-rw-r--r-- | bash/bash_completion.d/td.bash | 15 | ||||
-rw-r--r-- | bash/bash_completion.d/ud.bash | 14 | ||||
-rw-r--r-- | sh/shrc.d/sudo.sh | 5 |
13 files changed, 149 insertions, 6 deletions
@@ -18,9 +18,6 @@ Known issues * Would be good to complete the Makefile variables for NAME, EMAIL etc with educated guesses (`id -u`@`cat /etc/mailname`) etc rather than hardcoding my own stuff in there -* Completion for custom functions e.g. `sd` should ideally respect - `completion-ignore-case` setting -* Document `install-conf` target once I'm sure it's not a dumb idea * Need to decide whether I care about XDG, and implement it if I do * Need to decide whether I'm testing the shell snippets for MPD, Keychain etc, and if so how. @@ -54,6 +54,20 @@ to figure out which shell's configuration files to install, falling back on The remaining files can be installed with the other `install-*` targets. Try `awk -f bin/mftl.awk Makefile` in the project's root directory to see a list. +### Configuration + +To save a set of `make` targets useful for a specific user or host, you can +save them in a newline-separated file `~/.dotfiles.conf`, and install using +that with the special `install-conf` target. This can include variable +settings, too: + + $ cd + $ cat .dotfiles.conf + install-bash + install-bin + EMAIL=you@example.com + $ make -C .dotfiles install-conf + Tools ----- @@ -1,2 +1,2 @@ -tejr dotfiles v1.70.0 -Fri Sep 14 03:43:35 UTC 2018 +tejr dotfiles v1.71.0 +Mon Oct 29 21:39:22 UTC 2018 diff --git a/bash/bash_completion.d/eds.bash b/bash/bash_completion.d/eds.bash index 58ecf402..c4a9b9a9 100644 --- a/bash/bash_completion.d/eds.bash +++ b/bash/bash_completion.d/eds.bash @@ -10,6 +10,21 @@ _eds() { COMPREPLY[${#COMPREPLY[@]}]=$executable done < <( shopt -s dotglob nullglob + + # Make globbing case-insensitive if appropriate; is there a cleaner way + # to find this value? + while read -r _ option value ; do + case $option in + completion-ignore-case) + case $value in + on) + shopt -s nocaseglob + break + ;; + esac + esac + done < <(bind -v) + declare -a files files=("${EDSPATH:-"$HOME"/.local/bin}"/"${COMP_WORDS[COMP_CWORD]}"*) declare -a executables diff --git a/bash/bash_completion.d/keep.bash b/bash/bash_completion.d/keep.bash index 7148ad2b..5958aaf5 100644 --- a/bash/bash_completion.d/keep.bash +++ b/bash/bash_completion.d/keep.bash @@ -39,6 +39,21 @@ _keep() { COMPREPLY[${#COMPREPLY[@]}]=$word done < <( shopt -s dotglob nullglob + + # Make globbing case-insensitive if appropriate; is there a cleaner way + # to find this value? + while read -r _ option value ; do + case $option in + completion-ignore-case) + case $value in + on) + shopt -s nocaseglob + break + ;; + esac + esac + done < <(bind -v) + keep=${BASHKEEP:-"$HOME"/.bashkeep.d} declare -a keeps keeps=("$keep"/"${COMP_WORDS[COMP_CWORD]}"*.bash) diff --git a/bash/bash_completion.d/man.bash b/bash/bash_completion.d/man.bash index 658b5eb7..8e96abf7 100644 --- a/bash/bash_completion.d/man.bash +++ b/bash/bash_completion.d/man.bash @@ -35,6 +35,20 @@ _man() { shopt -u dotglob shopt -s extglob nullglob + # Make globbing case-insensitive if appropriate; is there a cleaner way + # to find this value? + while read -r _ option value ; do + case $option in + completion-ignore-case) + case $value in + on) + shopt -s nocaseglob + break + ;; + esac + esac + done < <(bind -v) + # Break manpath(1) output into an array of paths declare -a manpaths IFS=: read -a manpaths -r < <(manpath 2>/dev/null) diff --git a/bash/bash_completion.d/mysql.bash b/bash/bash_completion.d/mysql.bash index 2886f62e..d3cc1e7b 100644 --- a/bash/bash_completion.d/mysql.bash +++ b/bash/bash_completion.d/mysql.bash @@ -19,6 +19,20 @@ _mysql() { # Set options so that globs expand correctly shopt -s dotglob nullglob + # Make globbing case-insensitive if appropriate; is there a cleaner way + # to find this value? + while read -r _ option value ; do + case $option in + completion-ignore-case) + case $value in + on) + shopt -s nocaseglob + break + ;; + esac + esac + done < <(bind -v) + # Collect all the config file names, strip off leading path and .cnf local -a cnfs cnfs=("$dirname"/"${COMP_WORDS[COMP_CWORD]}"*.cnf) diff --git a/bash/bash_completion.d/pass.bash b/bash/bash_completion.d/pass.bash index feff78ae..e697f5d1 100644 --- a/bash/bash_completion.d/pass.bash +++ b/bash/bash_completion.d/pass.bash @@ -23,6 +23,20 @@ _pass() shopt -u dotglob shopt -s globstar nullglob + # Make globbing case-insensitive if appropriate; is there a cleaner way + # to find this value? + while read -r _ option value ; do + case $option in + completion-ignore-case) + case $value in + on) + shopt -s nocaseglob + break + ;; + esac + esac + done < <(bind -v) + # Gather the entries and remove their .gpg suffix declare -a entries entries=("$passdir"/"${COMP_WORDS[COMP_CWORD]}"*/**/*.gpg \ diff --git a/bash/bash_completion.d/path.bash b/bash/bash_completion.d/path.bash index ba2dcb79..21180b1a 100644 --- a/bash/bash_completion.d/path.bash +++ b/bash/bash_completion.d/path.bash @@ -26,6 +26,20 @@ _path() { # Set options to glob correctly shopt -s dotglob nullglob + # Make globbing case-insensitive if appropriate; is there a cleaner way + # to find this value? + while read -r _ option value ; do + case $option in + completion-ignore-case) + case $value in + on) + shopt -s nocaseglob + break + ;; + esac + esac + done < <(bind -v) + # Collect directory names, strip trailing slash local -a dirnames dirnames=("${COMP_WORDS[COMP_CWORD]}"*/) diff --git a/bash/bash_completion.d/sd.bash b/bash/bash_completion.d/sd.bash index aeb76fa0..c3690172 100644 --- a/bash/bash_completion.d/sd.bash +++ b/bash/bash_completion.d/sd.bash @@ -17,6 +17,20 @@ _sd() { # Set options to glob correctly shopt -s dotglob nullglob + # Make globbing case-insensitive if appropriate; is there a cleaner way + # to find this value? + while read -r _ option value ; do + case $option in + completion-ignore-case) + case $value in + on) + shopt -s nocaseglob + break + ;; + esac + esac + done < <(bind -v) + # Collect directory names, strip leading ../ and trailing / local -a dirnames dirnames=(../"${COMP_WORDS[COMP_CWORD]}"*/) diff --git a/bash/bash_completion.d/td.bash b/bash/bash_completion.d/td.bash index db232dd6..f04a7984 100644 --- a/bash/bash_completion.d/td.bash +++ b/bash/bash_completion.d/td.bash @@ -9,6 +9,21 @@ _td() { done < <( shopt -s extglob nullglob shopt -u dotglob + + # Make globbing case-insensitive if appropriate; is there a cleaner way + # to find this value? + while read -r _ option value ; do + case $option in + completion-ignore-case) + case $value in + on) + shopt -s nocaseglob + break + ;; + esac + esac + done < <(bind -v) + declare -a fns fns=("$dir"/"${COMP_WORDS[COMP_CWORD]}"*) fns=("${fns[@]#"$dir"/}") diff --git a/bash/bash_completion.d/ud.bash b/bash/bash_completion.d/ud.bash index 47171b78..eb038e12 100644 --- a/bash/bash_completion.d/ud.bash +++ b/bash/bash_completion.d/ud.bash @@ -13,6 +13,20 @@ _ud() { # Set options to glob correctly shopt -s dotglob nullglob + # Make globbing case-insensitive if appropriate; is there a cleaner way + # to find this value? + while read -r _ option value ; do + case $option in + completion-ignore-case) + case $value in + on) + shopt -s nocaseglob + break + ;; + esac + esac + done < <(bind -v) + # Collect directory names, strip trailing slashes local -a dirnames dirnames=("${COMP_WORDS[COMP_CWORD]}"*/) diff --git a/sh/shrc.d/sudo.sh b/sh/shrc.d/sudo.sh index a5883168..d9e30bc4 100644 --- a/sh/shrc.d/sudo.sh +++ b/sh/shrc.d/sudo.sh @@ -1,5 +1,8 @@ # Add the -H parameter to sudo(8) calls, always use the target user's $HOME sudo() { - [ "$1" != -v ] && set -- -H "$@" + case $1 in + -v) ;; + *) set -- -H "$@" ;; + esac command sudo "$@" } |