[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 04ee1fe 46/62: Auto-completion: Suggest plaint
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 04ee1fe 46/62: Auto-completion: Suggest plaintext tables too |
Date: |
Thu, 13 May 2021 22:20:53 -0400 (EDT) |
branch: master
commit 04ee1feeed6ac407d548a1bd4533c8dbbc065340
Author: Pedram Ashofteh Ardakani <pedramardakani@pm.me>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Auto-completion: Suggest plaintext tables too
Until now, autocomplete only suggested FITS files as input. With this
commit, plaintext files will be shown too.
Also, I have added the _gnuastro_autocomplete_list_all_valid_files
function to prevent redundant iteration over a list of files to check
for all acceptable file types.
---
bin/table/completion.bash | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/bin/table/completion.bash b/bin/table/completion.bash
index b98278e..907c184 100644
--- a/bin/table/completion.bash
+++ b/bin/table/completion.bash
@@ -133,6 +133,31 @@ _gnuastro_autocomplete_list_fits_names(){
+_gnuastro_autocomplete_list_plaintext_tables(){
+ local files=($(ls | grep -e "^$word" --color=never))
+ for f in ${files[*]} ; do
+ if _gnuastro_autocomplete_plaintext_is_table "$f"; then
+ COMPREPLY+=("$f"); fi
+ done
+}
+
+
+
+
+# List all files that are considered as valid input. This is here to
+# prevent going throught a list of files serveral times for each extension.
+_gnuastro_autocomplete_list_all_valid_files(){
+ local files=($(ls | grep -e "^$word" --color=never))
+ for f in ${files[*]} ; do
+ if _gnuastro_autocomplete_plaintext_is_table "$f"; then
+ COMPREPLY+=("$f"); fi
+ if $_gnuastro_astfits "$f" -q &> /dev/null; then COMPREPLY+=("$f"); fi
+ done
+}
+
+
+
+
# Prompt the user that this option only accepts a number
_gnuastro_autocomplete_expect_number(){
echo "Pass"
@@ -421,7 +446,7 @@ _gnuastro_asttable_completions(){
# should let the user choose a FITS table (to view its
# information).
if [ x"$last_table" = x ]; then
- _gnuastro_autocomplete_list_fits_names
+ _gnuastro_autocomplete_list_all_valid_files
else
_gnuastro_autocomplete_print_message "$infowarning"
COMPREPLY=()
- [gnuastro-commits] master 9ae830f 34/62: Table: Completion, replace double negative, (continued)
- [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
- [gnuastro-commits] master 88806f2 38/62: bin/table/completion.bash: improvements to find good table name, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 1bf469f 40/62: /bin/table/completion.bash: consider short opt '-i', Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master e340452 42/62: Auto-completion: Minor polishing of the warning message, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master e444941 45/62: Auto-completion: Call astfits/asttable consistently, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 04ee1fe 46/62: Auto-completion: Suggest plaintext tables too,
Mohammad Akhlaghi <=
- [gnuastro-commits] master 3754f1b 47/62: Auto-completion: Human readable arguments, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master ea08fdb 49/62: Auto-completion: return value from last table, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master ece1614 55/62: Auto complete: separated generic functions from Table's recipe, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master ef351da 56/62: TAB completion: now working for Arithmetic, better infrastructure, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master d2bf2c2 60/62: TAB completion: updated documentation and polished the code, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 4412710 29/62: Table: Completions, add missing options from help, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 82e9692 33/62: Book: Update the auto-complete section, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master abe3ca6 43/62: Auto-completion: Smart list fits files, fix var, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master a66e8bb 57/62: TAB completion: BuildProgram support added, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master d7bf627 59/62: TAB completion: support added for CosmicCalculator and Crop, Mohammad Akhlaghi, 2021/05/13