gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master ea08fdb 49/62: Auto-completion: return value f


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master ea08fdb 49/62: Auto-completion: return value from last table
Date: Thu, 13 May 2021 22:20:53 -0400 (EDT)

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

    Auto-completion: return value from last table
    
    Until now, the _gnuastro_autocomplete_last_table function would not
    return anything. It would just set a global variable. However, it might
    be a better idea to use return values instead of breaking the loops.
    Because later we can use the return value as a signal if need be.
---
 bin/table/completion.bash | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/bin/table/completion.bash b/bin/table/completion.bash
index aeb0abb..ddb3618 100644
--- a/bin/table/completion.bash
+++ b/bin/table/completion.bash
@@ -303,16 +303,19 @@ _gnuastro_autocomplete_last_table(){
                 # break out of the loop that parses the tokens.
                 if $_gnuastro_asttable $token -h$last_table_hdu -i &> 
/dev/null; then
                     last_table="$token"
-                    break;
+                    return 0
                 fi
 
             # Not a FITS file.
             else
                 if _gnuastro_autocomplete_is_plaintext_table $token; then
                     last_table="$token"
-                    break;
+                    return 0
                 fi
             fi
+        else
+            # The file $token does not exist
+            return 1
         fi
     done
 }



reply via email to

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