|
|
2d15635 |
From ab5543f5af8ee9c29465245688b0328191ecb29c Mon Sep 17 00:00:00 2001
|
|
|
2d15635 |
From: Eric Cook <llua@gmx.com>
|
|
|
2d15635 |
Date: Sun, 27 Jul 2014 15:07:03 -0400
|
|
|
2d15635 |
Subject: [PATCH] shell-completion: prevent mangling unit names (bash)
|
|
|
2d15635 |
|
|
|
2d15635 |
This fixes the issue noted by Zbigniew in most cases.
|
|
|
2d15635 |
if a unit's name is enclosed in single quotes completion still
|
|
|
2d15635 |
will not happen after the first `\'.
|
|
|
2d15635 |
|
|
|
2d15635 |
https://bugs.freedesktop.org/show_bug.cgi?id=78388
|
|
|
2d15635 |
(cherry picked from commit c317a1a19cd9584e07ee43f1b6fafc26c2c75cca)
|
|
|
2d15635 |
---
|
|
|
2d15635 |
shell-completion/bash/systemctl.in | 13 ++++++++++++-
|
|
|
2d15635 |
1 file changed, 12 insertions(+), 1 deletion(-)
|
|
|
2d15635 |
|
|
|
2d15635 |
diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in
|
|
|
2d15635 |
index 7959ad2dd7..e7f736c70b 100644
|
|
|
2d15635 |
--- a/shell-completion/bash/systemctl.in
|
|
|
2d15635 |
+++ b/shell-completion/bash/systemctl.in
|
|
|
2d15635 |
@@ -158,20 +158,25 @@ _systemctl () {
|
|
|
2d15635 |
|
|
|
2d15635 |
elif __contains_word "$verb" ${VERBS[ALL_UNITS]}; then
|
|
|
2d15635 |
comps=$( __get_all_units $mode )
|
|
|
2d15635 |
+ compopt -o filenames
|
|
|
2d15635 |
|
|
|
2d15635 |
elif __contains_word "$verb" ${VERBS[ENABLED_UNITS]}; then
|
|
|
2d15635 |
comps=$( __get_enabled_units $mode )
|
|
|
2d15635 |
+ compopt -o filenames
|
|
|
2d15635 |
|
|
|
2d15635 |
elif __contains_word "$verb" ${VERBS[DISABLED_UNITS]}; then
|
|
|
2d15635 |
comps=$( __get_disabled_units $mode )
|
|
|
2d15635 |
+ compopt -o filenames
|
|
|
2d15635 |
|
|
|
2d15635 |
elif __contains_word "$verb" ${VERBS[REENABLABLE_UNITS]}; then
|
|
|
2d15635 |
comps=$( __get_disabled_units $mode;
|
|
|
2d15635 |
__get_enabled_units $mode )
|
|
|
2d15635 |
+ compopt -o filenames
|
|
|
2d15635 |
|
|
|
2d15635 |
elif __contains_word "$verb" ${VERBS[STARTABLE_UNITS]}; then
|
|
|
2d15635 |
comps=$( __filter_units_by_property $mode CanStart yes \
|
|
|
2d15635 |
$( __get_startable_units $mode))
|
|
|
2d15635 |
+ compopt -o filenames
|
|
|
2d15635 |
|
|
|
2d15635 |
elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then
|
|
|
2d15635 |
comps=$( __filter_units_by_property $mode CanStart yes \
|
|
|
2d15635 |
@@ -179,24 +184,30 @@ _systemctl () {
|
|
|
2d15635 |
| while read -r line; do \
|
|
|
2d15635 |
[[ "$line" =~ \.(device|snapshot|socket|timer)$ ]] || echo " $line"; \
|
|
|
2d15635 |
done ))
|
|
|
2d15635 |
+ compopt -o filenames
|
|
|
2d15635 |
|
|
|
2d15635 |
elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then
|
|
|
2d15635 |
comps=$( __filter_units_by_property $mode CanStop yes \
|
|
|
2d15635 |
$( __get_active_units $mode ) )
|
|
|
2d15635 |
+ compopt -o filenames
|
|
|
2d15635 |
|
|
|
2d15635 |
elif __contains_word "$verb" ${VERBS[RELOADABLE_UNITS]}; then
|
|
|
2d15635 |
comps=$( __filter_units_by_property $mode CanReload yes \
|
|
|
2d15635 |
$( __get_active_units $mode ) )
|
|
|
2d15635 |
+ compopt -o filenames
|
|
|
2d15635 |
|
|
|
2d15635 |
elif __contains_word "$verb" ${VERBS[ISOLATABLE_UNITS]}; then
|
|
|
2d15635 |
comps=$( __filter_units_by_property $mode AllowIsolate yes \
|
|
|
2d15635 |
$( __get_all_units $mode ) )
|
|
|
2d15635 |
+ compopt -o filenames
|
|
|
2d15635 |
|
|
|
2d15635 |
elif __contains_word "$verb" ${VERBS[FAILED_UNITS]}; then
|
|
|
2d15635 |
comps=$( __get_failed_units $mode )
|
|
|
2d15635 |
+ compopt -o filenames
|
|
|
2d15635 |
|
|
|
2d15635 |
elif __contains_word "$verb" ${VERBS[MASKED_UNITS]}; then
|
|
|
2d15635 |
comps=$( __get_masked_units $mode )
|
|
|
2d15635 |
+ compopt -o filenames
|
|
|
2d15635 |
|
|
|
2d15635 |
elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[NAME]}; then
|
|
|
2d15635 |
comps=''
|
|
|
2d15635 |
@@ -221,7 +232,7 @@ _systemctl () {
|
|
|
2d15635 |
| { while read -r a b; do echo " $a"; done; } )
|
|
|
2d15635 |
fi
|
|
|
2d15635 |
|
|
|
2d15635 |
- COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
|
|
2d15635 |
+ COMPREPLY=( $(compgen -o filenames -W '$comps' -- "$cur") )
|
|
|
2d15635 |
return 0
|
|
|
2d15635 |
}
|
|
|
2d15635 |
|