[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 97d9a1e 09/62: Table: Completion suggests matc
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 97d9a1e 09/62: Table: Completion suggests matching words |
Date: |
Thu, 13 May 2021 22:20:46 -0400 (EDT) |
branch: master
commit 97d9a1ecd02ab4e5dd3a79b6b4cc001ef13e4a12
Author: Pedram Ashofteh Ardakani <pedramardakani@pm.me>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Table: Completion suggests matching words
* Until now, the word that the user wrote was removed by completion.
With this commit, the suggestions are smarter and actually useful.
---
bin/table/completion.sh | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/bin/table/completion.sh b/bin/table/completion.sh
index e1fe499..8d4aaac 100644
--- a/bin/table/completion.sh
+++ b/bin/table/completion.sh
@@ -17,9 +17,9 @@ _gnuastro_autocomplete_fits_hdu_read(){
COMPREPLY=($("$ASTFITS --quiet $1" | awk '{print $2}'))
}
-_gnuastro_autocomplete_fits_list_files(){
+_gnuastro_autocomplete_list_fits_files(){
# Suggest all 'FITS' files in current directory. Case insensitive.
- COMPREPLY+=($(compgen -f -X "!*.[fF][iI][tT][sS]"));
+ COMPREPLY=($(compgen -f -X "!*.[fF][iI][tT][sS]"));
}
_gnuastro_autocomplete_column_read(){
@@ -45,7 +45,9 @@ _gnuastro_file_last_occurance(){
# astconvolve --help | awk -v pattern="^ *-([a-z]|[A-Z])" 'match($0, pattern)
{print $0}'
_gnuastro_autocomplete_list_all_options(){
- COMPREPLY=($($1 --help | awk -v regex=" --+([a-z]|[A-Z]|[0-9])*"
'match($0, regex) {print substr($0, RSTART, RLENGTH)}'))
+ # The regex variable in the awk program contains the regular expression
+ # pattern that matches all options provided in corresponding program
+ COMPREPLY=($(compgen -W "$($1 --help | awk -v regex="
--+([a-z]|[A-Z]|[0-9])*" 'match($0, regex) {print substr($0, RSTART,
RLENGTH)}')" -- "$word"))
}
_gnuastro_asttable_completions(){
@@ -65,12 +67,10 @@ _gnuastro_asttable_completions(){
local prev="${COMP_WORDS[COMP_CWORD-1]}";
case "$word" in
- -i|--information)
- _gnuastro_autocomplete_fits_list_files
- ;;
+ -i|--information) _gnuastro_autocomplete_list_fits_files ;;
-b|--noblank) ;;
-h|--hdu) ;;
- # default case
+ # The default case populates suggestions with all options available
*) _gnuastro_autocomplete_list_all_options $PROG_NAME ;;
esac
- [gnuastro-commits] master f4cf33d 17/62: Tabel: Completion, examine for fits availability, (continued)
- [gnuastro-commits] master f4cf33d 17/62: Tabel: Completion, examine for fits availability, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master e1c1a4b 18/62: Table: Completion, fix 'wcshdu', Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 6fe9cb6 20/62: Table: Completion, refactor awk regex fits name, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master c593823 23/62: Table: Completion, fix hdu and fits suggestions, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 0420521 04/62: Completion: bug fix in catching the options, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 3d8e96d 10/62: Table: Fix completion issue, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master f2ccd6e 12/62: Table: Completion, fix reading fits column, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master d0e1362 14/62: Table: Completion, better function name, copyright, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 7ad725a 21/62: Table: Completion, fix hdu and fits suggestions, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master b391ee8 22/62: Table: Completion, bash4+ long option no space, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 97d9a1e 09/62: Table: Completion suggests matching words,
Mohammad Akhlaghi <=
- [gnuastro-commits] master 9ea367b 16/62: Table: Completion, handle '=', do not append space, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 7c95cec 24/62: Table: Completion, better POSIX portability, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 19ebe93 26/62: Table: Completion, improve _compgen, put quotes, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 7b584a4 31/62: Table: Completion, update shebang, fix formatting, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master c259040 39/62: bin/table/completion.bash: Fix '--information', Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 6efd4ff 32/62: Book: Add auto-complete to the developing section, Mohammad Akhlaghi, 2021/05/13
- [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