From f295343814757a7e16973146c24b5789a6b047a0 Mon Sep 17 00:00:00 2001 From: Martin Winkler Date: Sun, 29 May 2022 18:38:13 +0200 Subject: [PATCH] WIP sqn alias in lower case, end output if no profiles or steps are found --- sqn-completion.bash | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sqn-completion.bash b/sqn-completion.bash index a8488f6..fd28964 100755 --- a/sqn-completion.bash +++ b/sqn-completion.bash @@ -41,6 +41,7 @@ _sqn_completions() # Support for profile names with spaces COMPREPLY+=("$(printf '%q' "${comp}")") done + [[ ${#COMPREPLY[@]} == 0 ]] && COMPREPLY=( "-- No profiles found --" " " ) ;; *) # Stop after step selection (last argument which is not an option (starting with "-|+") @@ -61,6 +62,7 @@ _sqn_completions() # Support for aliases with spaces COMPREPLY+=("$(printf '%q' "${comp}")") done + [[ ${#COMPREPLY[@]} == 0 ]] && COMPREPLY=( "-- No steps found --" " " ) ;; esac ;; @@ -92,7 +94,7 @@ installCompletion() { seq_short[$i]="${seq_prefix}${seq_list[$i]/[[:blank:]]/_}" # shellcheck disable=SC2139,SC2086 # alias should be expanded when defined - alias ${seq_short[$i]}="_SQN_ALIAS=\"${seq_short[$i]}\" \"${seq_base}/${seq_list[$i]}.sh\"" + alias ${seq_short[$i]}="_sqn_alias=\"${seq_short[$i]}\" \"${seq_base}/${seq_list[$i]}.sh\"" done complete -o nosort -o bashdefault -o default -F _sqn_completions "${seq_short[@]}" }