Commit b150d864 authored by Romain Aigron's avatar Romain Aigron Committed by Jouke Witteveen
Browse files

Fix bash completion for profiles names.



This patch fixes completion for the netctl and netctl_auto
commands for profiles names, treating them as filenames.
This allow proper completion for profiles with spaces or quotes in their
name (as it happends for instance with wifi-menu's autogenerated profile
names)

Signed-off-by: default avatarRomain Aigron <aigron.romain@wanadoo.fr>
parent f907353a
......@@ -13,7 +13,9 @@ _wireless_interfaces()
_netctl_profiles()
{
find -L /etc/netctl -maxdepth 1 -type f -not -name '.*' -not -name '*~' -not -name $'*\n*' -not -name '*.action' -not -name '*.conf' -not -name '*.service' -printf "%f\n"
local profile
find -L /etc/netctl -maxdepth 1 -type f -not -name '.*' -not -name '*~' -not -name $'*\n*' -not -name '*.action' -not -name '*.conf' -not -name '*.service' -printf "%f\n" |
while read -r profile; do quote_readline "$profile"; echo; done
}
......@@ -27,6 +29,7 @@ _netctl()
;;
2)
[[ ${COMP_WORDS[COMP_CWORD-1]} = @(start|stop|restart|switch-to|is-active|status|enable|disable|reenable|is-enabled|edit) ]] &&
compopt -o filenames &&
mapfile -t COMPREPLY < <(IFS=$'\n'; compgen -W "$(_netctl_profiles)" -- "$cur")
;;
esac
......@@ -44,6 +47,7 @@ _netctl_auto()
;;
2)
[[ ${COMP_WORDS[COMP_CWORD-1]} = @(switch-to|is-active|enable|disable|is-enabled) ]] &&
compopt -o filenames &&
mapfile -t COMPREPLY < <(IFS=$'\n'; compgen -W "$(_netctl_profiles)" -- "$cur")
;;
esac
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment