gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 6fe9cb6 20/62: Table: Completion, refactor awk


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 6fe9cb6 20/62: Table: Completion, refactor awk regex fits name
Date: Thu, 13 May 2021 22:20:48 -0400 (EDT)

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

    Table: Completion, refactor awk regex fits name
    
    With this commit, a simpler regex is used for finding the fits files in
    current directory.
    
    Also, few other words are added about taking care of the short options.
---
 bin/table/completion.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bin/table/completion.sh b/bin/table/completion.sh
index d77f0f6..8718c7d 100644
--- a/bin/table/completion.sh
+++ b/bin/table/completion.sh
@@ -10,7 +10,8 @@
 # autocompletion. Because only the advanced users may use them. And it is
 # possible to mix them up. So, only those will use the short options who
 # know what they are doing. Hence, they will not need the autocompletion
-# feature binded to the short options.
+# feature binded to the short options.  However, the short options are
+# taken into consideration for suggesting the upcoming commands.
 
 # TIP: Run the command below to initialize the bash completion feature for
 # this specific program (i.e. astcosmiccal):
@@ -52,7 +53,7 @@ _gnuastro_autocomplete_get_fits_name(){
     # Get the first fits file among the command line and put it into the
     # $comp_fits_name variable
     # TODO: How about all other fits file extensions?
-    local file_name="$(echo ${COMP_WORDS[@]} | awk -v 
regex="[a-zA-Z]*.[fF][iI][tT][sS]" 'match($0, regex) {print substr($0, RSTART, 
RLENGTH)}')"
+    local file_name="$(echo ${COMP_WORDS[@]} | awk -v 
regex=".[fF][iI][tT][sS]" 'match($0, regex) {print substr($0, RSTART, 
RLENGTH)}')"
     if [ -f "$file_name" ]; then
         # Check if file_name is actually an existing fits file. This
         # prevents other functions from failing and producing obscure error



reply via email to

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