On Sat, Jul 26, 2014 at 05:24:11PM -0400, Eric Cook wrote: > This looks seems like it should work. I would appreciate it if you could > trail run it. > My use of bash is limited and knowledge of it's completion system even more > so. > ---
Unfortunately it works only partially. It seems that completions are generated properly, but bash doesn't seem to be able to continue after a backslash, so one has to copy in the remaining part by hand. Zbyszek > shell-completion/bash/systemctl.in | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/shell-completion/bash/systemctl.in > b/shell-completion/bash/systemctl.in > index c5950cc..113694f 100644 > --- a/shell-completion/bash/systemctl.in > +++ b/shell-completion/bash/systemctl.in > @@ -46,25 +46,25 @@ __filter_units_by_property () { > <(__systemctl $mode show --property "$property" -- "${units[@]}") > for ((i=0; $i < ${#units[*]}; i++)); do > if [[ "${props[i]}" = "$property=$value" ]]; then > - echo " ${units[i]}" > + printf '%q\n' " ${units[i]}" > fi > done > } > > __get_all_units () { __systemctl $1 list-units --all \ > - | { while read -r a b; do echo " $a"; done; }; } > + | { while read -r a b; do printf '%q\n' " $a"; done; }; } > __get_active_units () { __systemctl $1 list-units \ > - | { while read -r a b; do echo " $a"; done; }; } > + | { while read -r a b; do printf '%q\n' " $a"; done; }; } > __get_startable_units () { __systemctl $1 list-units --all -t > service,timer,socket,mount,automount,path,snapshot,swap \ > - | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed" > ]] && echo " $a"; done; }; } > + | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed" > ]] && printf '%q\n' " $a"; done; }; } > __get_failed_units () { __systemctl $1 list-units \ > - | { while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; > done; }; } > + | { while read -r a b c d; do [[ $c == "failed" ]] && printf > '%q\n' " $a"; done; }; } > __get_enabled_units () { __systemctl $1 list-unit-files \ > - | { while read -r a b c ; do [[ $b == "enabled" ]] && echo " $a"; > done; }; } > + | { while read -r a b c ; do [[ $b == "enabled" ]] && printf > '%q\n' " $a"; done; }; } > __get_disabled_units () { __systemctl $1 list-unit-files \ > - | { while read -r a b c ; do [[ $b == "disabled" ]] && echo " $a"; > done; }; } > + | { while read -r a b c ; do [[ $b == "disabled" ]] && printf > '%q\n' " $a"; done; }; } > __get_masked_units () { __systemctl $1 list-unit-files \ > - | { while read -r a b c ; do [[ $b == "masked" ]] && echo " $a"; > done; }; } > + | { while read -r a b c ; do [[ $b == "masked" ]] && printf > '%q\n' " $a"; done; }; } > > _systemctl () { > local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} > -- > 2.0.2 > > _______________________________________________ > systemd-devel mailing list > systemd-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/systemd-devel > _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel