gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 1bf469f 40/62: /bin/table/completion.bash: con


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 1bf469f 40/62: /bin/table/completion.bash: consider short opt '-i'
Date: Thu, 13 May 2021 22:20:51 -0400 (EDT)

branch: master
commit 1bf469f8a9e314b36c359f6a898df7dfed821fdb
Author: Pedram Ashofteh Ardakani <pedramardakani@pm.me>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    /bin/table/completion.bash: consider short opt '-i'
    
    The '--information' long and short option '-i' should have the same
    autocompletion suggestions. With this commit, the autocompletion will
    cease providing suggestions when '-i' or '--information' option is
    selected while the fits file is specified.
    
    I could have used the bash extended glob: @(pattern1|pattern2) in the
    pattern matching binary operator '=~' inside the '[[ ... ]]' keyword.
    But I refrained to do so, since we try not to use more modern operators
    to keep the backward compatibility (for Bash older than 3.2 or so).
---
 bin/table/completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/table/completion.bash b/bin/table/completion.bash
index 2384b1b..2a8ad5d 100644
--- a/bin/table/completion.bash
+++ b/bin/table/completion.bash
@@ -388,7 +388,7 @@ _gnuastro_asttable_completions(){
 
     # when a File has been given, and the information option is called, we
     # should tell the user to avoid trying new options and just press ENTER
-    if [[ "$COMP_LINE" =~ "--information" ]] && [ -f "$last_table" ]; then
+    if [ -f "$last_table" ] && [[ "$COMP_LINE" =~ "--information" ]] || [[ 
"$COMP_LINE" =~ " -i" ]]; then
         printf "\nThe '--information' (or '-i') will disable all other 
options, you can safely press ENTER now.\n%s" "$COMP_LINE"
         COMPREPLY=()
     else



reply via email to

[Prev in Thread] Current Thread [Next in Thread]