iSulad/0079-added-default-completion.patch

42 lines
1.0 KiB
Diff
Raw Normal View History

From 68147c64b7dc1f9ef149781e4c10d37b0b2c59f5 Mon Sep 17 00:00:00 2001
From: yinxiujiang <yinxiujiang@kylinos.cn>
Date: Wed, 21 Apr 2021 09:33:05 +0800
Subject: [PATCH 079/104] added default completion
---
src/contrib/completion/isula | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/contrib/completion/isula b/src/contrib/completion/isula
index 305c5150..a12d90a5 100644
--- a/src/contrib/completion/isula
+++ b/src/contrib/completion/isula
@@ -65,6 +65,10 @@ _isula_isula() {
esac
}
+_isula_default()
+{
+ COMPREPLY=( $( compgen -d -f -- $cur ) )
+}
_isula() {
COMPREPLY=()
@@ -81,9 +85,12 @@ _isula() {
#The completion of the secondary command will be added later
if [ $cword -lt 2 ] ; then
- declare -F $completions_func >/dev/null && $completions_func
+ completions_func=_isula_${command//-/_}
+ else
+ completions_func=_isula_default
fi
+ declare -F $completions_func >/dev/null && $completions_func
return 0
}
--
2.25.1