1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-29 18:50:08 +03:00

B OpenNebula/one#6345: Fix oneflow CLI autocompletion (#2772)

(cherry picked from commit 0b2ce6c700614279a0bc504de88df6919307a82a)
This commit is contained in:
Daniel Clavijo Coca 2023-10-09 10:49:28 -06:00 committed by Tino Vázquez
parent 1694d5681b
commit ba2dac354f
No known key found for this signature in database
GPG Key ID: 14201E424D02047E

View File

@ -33,17 +33,27 @@ _complete() {
}
_one_list() {
cmd=$1
if [ -z "$2" ]; then
col="$COL_NAME"
column="$COL_NAME"
else
col=$2
column=$2
fi
filter=$3
if [ -n "$3" ]; then
$1 list --no-header --csv -f "$3" -l "$col"
else
$1 list --no-header --csv -l "$col"
fi
case "$cmd" in
oneflow|oneflow-server|oneflow-template)
# everything under 4th column, NAME by default
$cmd list | awk 'NR > 1 {print $4}' # TODO: Implement --csv option for oneflow CLI
;;
*)
if [ -n "$filter" ]; then
$cmd list --no-header --csv -f "$filter" -l "$column"
else
$cmd list --no-header --csv -l "$column"
fi
;;
esac
}
_one_simple() {