[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 90f08c2 53/62: Auto-completion: Refactor ..._i
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 90f08c2 53/62: Auto-completion: Refactor ..._is_table function |
Date: |
Thu, 13 May 2021 22:20:54 -0400 (EDT) |
branch: master
commit 90f08c2d8c4e659551170e55acd4e1311348ecbf
Author: Pedram Ashofteh Ardakani <pedramardakani@pm.me>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Auto-completion: Refactor ..._is_table function
With this commit, I replaced 'return 0' (or 1) with 'break' as it used to
be. Because we are not using the function as a boolean query. However, we
can se if there is a valid FITS or plaintext file withing the command
line by checking if the $last_table is populated: [ x$last_table != x ]
Also, I replaced an indented 'if' with 'elif' for better code readablity.
---
bin/table/completion.bash | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/bin/table/completion.bash b/bin/table/completion.bash
index 472549f..3298488 100644
--- a/bin/table/completion.bash
+++ b/bin/table/completion.bash
@@ -259,7 +259,7 @@ _gnuastro_autocomplete_is_plaintext_table(){
# Reverse the list of existing strings on the command-line (so the last
# word becomes the first), then check if it is an acceptable Table file in
-# there.
+# there. This covers FITS and plaintext files so far.
_gnuastro_autocomplete_last_table(){
# Output variables.
@@ -299,19 +299,14 @@ _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"
- return 0
+ break;
fi
- # Not a FITS file.
- else
- if _gnuastro_autocomplete_is_plaintext_table $token; then
- last_table="$token"
- return 0
- fi
+ # Not a FITS file, check if it is a plaintext table.
+ elif _gnuastro_autocomplete_is_plaintext_table $token; then
+ last_table="$token"
+ break;
fi
- else
- # The file $token does not exist
- return 1
fi
done
}
- [gnuastro-commits] master 0e382bc 11/62: Table: Completion, suggest columns inside fits, (continued)
- [gnuastro-commits] master 0e382bc 11/62: Table: Completion, suggest columns inside fits, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 328ab31 19/62: Table: Completion, thoughts on short options, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master b5c4f29 27/62: Table: Completion, add options, improve get name, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 86df9d8 25/62: Table: Completion, custom compgen, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 51daecd 30/62: Table: Completion, update copyright, minor edits, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master e690fc5 37/62: Bash completion: renamed fixed file to completion.bash, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 229ac51 41/62: /bin/table/completion.bash: Refactor code, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 50026ec 48/62: Auto-completion: Rename boolean query functions, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 8150e1c 50/62: Auto-completion: Refactor FITS related functions, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master afadccf 52/62: Auto-completion: Call ..._last_table where needed, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 90f08c2 53/62: Auto-completion: Refactor ..._is_table function,
Mohammad Akhlaghi <=
- [gnuastro-commits] master 4598eba 54/62: Auto-completion: clean re-implementation for Table, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 59669d9 61/62: Book: new section on known issues with Crop, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master b947f79 62/62: TAB completion: enabled in Fits program, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master acf58c1 58/62: TAB completion: now supported in ConvertType and Convolve, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 9ae830f 34/62: Table: Completion, replace double negative, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 7f1a203 35/62: Book: Autocompletion for developers example, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 6379566 36/62: Book: edits to the Bash auto-completion section, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 9335953 44/62: Auto-completion: Faster fits parse, use 'local', Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 284a32e 51/62: Auto-completion: Debug -i, improve performance, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master e5707cd 28/62: Table: Completion, all options, update comments, Mohammad Akhlaghi, 2021/05/13