git @ Cat's Eye Technologies ellsync / b276dbd
Improve tab-completion script. Chris Pressey 1 year, 6 months ago
2 changed file(s) with 9 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
147147 is for example owned by another user and not world-readable, it will abort.
148148 `ellsync` does not currently detect this properly. It should be made to handle
149149 it gracefully, if possible.
150 * Tab-completion of stream names.
151150 * Better test case for `--thorough`.
152151 * When executing system commands, don't use shell expansion.
153152 * (Aspirational) Ability to convert the backup router to a `dot` file (`graphviz`)
164163 in the order they are given on the command line. OS-level `sync` will only be
165164 performed once, at the very end.
166165
166 A bash tab-completion script is included in the `script` directory. It enables
167 tab-completion of both subcommand names, and stream names in the `sync` subcommand.
168
167169 ### 0.4
168170
169171 The `:` in a backup stream identifier is optional, when no subdirectory is being
77 local word=${COMP_WORDS[COMP_CWORD]}
88 local line=${COMP_LINE}
99
10 IFS=' ' read -raargv<<< "$line"
10 # Split the command line into arguments and place them in the $argv[@] array.
11 # We append a character ('%') so that we can tell if user is on a partial word or on a space.
12 # So, the count in $argc is right, but the final value in the $argv[@] array is not accurate.
13 # That's acceptable for our purposes.
14 IFS=' ' read -raargv<<< "$line%"
1115 local argc=${#argv[@]}
1216
1317 if [ $argc -eq 2 ]; then
1620 COMPREPLY=($(compgen -W "list sync rename" "${word}"))
1721 elif [ $argc -gt 3 ]; then
1822 local router="${argv[1]}"
19 local streams=`ellsync $router list --stream-name-only`
23 local streams=`ellsync $router list --stream-name-only 2>/dev/null`
2024 COMPREPLY=($(compgen -W "${streams}" "${word}"))
2125 fi
2226 }