From aff1099b0a4adb9dc7de20fb1914a80f80f88c21 Mon Sep 17 00:00:00 2001 From: Arthur Zamarin Date: Fri, 26 Apr 2024 12:10:26 +0300 Subject: [PATCH] shell completion: fix machinectl import-{tar,raw} Signed-off-by: Arthur Zamarin (cherry picked from commit 3eb329bfb5df8f5b6eba9cef195dff54b9ba0e4b) --- shell-completion/bash/machinectl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shell-completion/bash/machinectl b/shell-completion/bash/machinectl index b28769b0b6..6e89a3c1d2 100644 --- a/shell-completion/bash/machinectl +++ b/shell-completion/bash/machinectl @@ -106,8 +106,12 @@ _machinectl() { comps=$( __get_machines ) elif __contains_word "$verb" ${VERBS[FILE]}; then - comps=$(compgen -f -- "cur") - compopt -o filenames + if (( COMP_CWORD == i + 1 )); then # first argument after verb + comps=$(compgen -f -- "$cur") + compopt -o filenames + else + comps='' + fi fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") )