[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master f4cf33d 17/62: Tabel: Completion, examine for
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master f4cf33d 17/62: Tabel: Completion, examine for fits availability |
Date: |
Thu, 13 May 2021 22:20:47 -0400 (EDT) |
branch: master
commit f4cf33df2fd1848a0f021b07c465e3cbdf6cca7e
Author: Pedram Ashofteh Ardakani <pedramardakani@pm.me>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Tabel: Completion, examine for fits availability
Until now, after the user entered either commands '--information' or
'--wcsfile' the autocomplete would suggest a fits file name. This is a
bad idea when the user has already defined the file.
With this commit, we will check if the user has specified the file
already, if so, we will carry on with suggesting all other options at
hand. On the other hand, we will suggest a fits file living in current
directory.
Still, if there were no fits files in the current directory,
autocompletion will not suggest anything. This might signal the user
that something is wrong.
Also, I elaborated on the '--column' option's comments.
---
bin/table/completion.sh | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/bin/table/completion.sh b/bin/table/completion.sh
index d31481d..113c09d 100644
--- a/bin/table/completion.sh
+++ b/bin/table/completion.sh
@@ -112,9 +112,26 @@ _gnuastro_asttable_completions(){
# TODO: Prettify the code syntax, shorter ones on top
case "$prev" in
- -i|--information) _gnuastro_autocomplete_list_fits_names ;;
- -c|--column) _gnuastro_autocomplete_list_fits_columns "$fits_name" ;;
- -w|--wcsfile) _gnuastro_autocomplete_list_fits_names ;;
+ asttable) _gnuastro_autocomplete_list_fits_names ;;
+ -i|--information|-w|--wcsfile)
+ if [ -z _gnuastro_autocomplete_get_fits_name ]; then
+ # Check if the user has already specified a fits file. If
+ # the _gnuastro_autocomplete_get_file_name echoes an empty
+ # response, it means no fits files were specified.
+ _gnuastro_autocomplete_list_fits_names
+ else
+ # The user has entered a valid fits file name. So keep on
+ # with suggesting all other options at hand.
+ _gnuastro_autocomplete_list_options $PROG_NAME
+ fi
+ ;;
+ -c|--column)
+ # The function below, checks if the user has specified a fits
+ # file in the current commandline. If not, there will be no
+ # response from autocompletion. This might alert the user that
+ # something is going wrong.
+ _gnuastro_autocomplete_list_fits_columns "$fits_name"
+ ;;
-W|--wcshdu) _gnuastro_autocomplete_list_fits_hdu "$fits_name" ;;
-b|--noblank) ;;
-h|--hdu) ;;
- [gnuastro-commits] master updated (ffc7608 -> b947f79), Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 1c1fe3d 01/62: New feature: Auto Complete (WIP), Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master c02ae2c 02/62: Completion: feed options from `help`, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master b06fbce 03/62: Completion: Fix indentations, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master a829b24 05/62: Completion: Suggest FITS files in relevant options, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 3da00c3 07/62: Table: Prepare initial completion script, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 477d23d 06/62: Rename completion files, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 39efeea 08/62: Table: First working completion, general commands, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 32cbe32 13/62: Table: Completion, better formatting, add function, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master d631f5b 15/62: Table: Completion, remove global variables, etc, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master f4cf33d 17/62: Tabel: Completion, examine for fits availability,
Mohammad Akhlaghi <=
- [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, 2021/05/13