diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2015-11-26 18:38:18 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2015-11-26 18:38:18 +1300 |
commit | 838cc05fcecf1962ce724f5b1b894d4a6e2998bb (patch) | |
tree | fde5848b00fd4d1866e2dd45b3c78c01e272148b | |
parent | Shellquote man(1) page names (diff) | |
download | dotfiles-838cc05fcecf1962ce724f5b1b894d4a6e2998bb.tar.gz dotfiles-838cc05fcecf1962ce724f5b1b894d4a6e2998bb.zip |
Fix/flesh out the comments a bit
-rw-r--r-- | bash/bashrc.d/man.bash | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bash/bashrc.d/man.bash b/bash/bashrc.d/man.bash index 4e656887..8a6df3ea 100644 --- a/bash/bashrc.d/man.bash +++ b/bash/bashrc.d/man.bash @@ -15,7 +15,8 @@ _man() { section='man'${COMP_WORDS[COMP_CWORD-1]} fi - # Read slash-separated output from a subshell into the COMPREPLY array + # Read slash-separated output from a subshell into the COMPREPLY array; use + # read -a rather than adding each element individually, as it's much faster IFS=/ read -a COMPREPLY -d '' -r < <( # Do not return dotfiles, and expand empty globs to just nothing @@ -43,8 +44,7 @@ _man() { # printing ((${#pages[@]})) || exit 1 - # Print the pages array to stdout, newline-separated; see above - # explanation + # Print the pages array to stdout, slash-separated, null-terminated (IFS=/ ; printf '%q\0' "${pages[*]}") ) } |