[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 477d23d 06/62: Rename completion files
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 477d23d 06/62: Rename completion files |
Date: |
Thu, 13 May 2021 22:20:45 -0400 (EDT) |
branch: master
commit 477d23dc37db6242191b64c08ac7a01ef3153f9f
Author: Pedram Ashofteh Ardakani <pedramardakani@pm.me>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Rename completion files
* Until now, I was just working on the CosmicCalculator program. With
this commit, I will start my work on the Table program. This is
because the Table program accepts a variety of inputs, which means its
completion script can be used as a template for all other programs.
---
...{astcosmiccal-completion.bash => completion.sh} | 0
.../completion.sh} | 56 ++++++++++++++++++++--
2 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/bin/cosmiccal/astcosmiccal-completion.bash
b/bin/cosmiccal/completion.sh
similarity index 100%
copy from bin/cosmiccal/astcosmiccal-completion.bash
copy to bin/cosmiccal/completion.sh
diff --git a/bin/cosmiccal/astcosmiccal-completion.bash
b/bin/table/completion.sh
similarity index 55%
rename from bin/cosmiccal/astcosmiccal-completion.bash
rename to bin/table/completion.sh
index 9205b43..edb26dd 100644
--- a/bin/cosmiccal/astcosmiccal-completion.bash
+++ b/bin/table/completion.sh
@@ -4,7 +4,47 @@
# this specific program (i.e. astcosmiccal):
# $ source astcosmiccal-completion.bash
-_astcosmiccal_completions(){
+# GLOBAL VARIABLES
+
+PREFIX="/usr/local/bin";
+ASTFITS="$PREFIX/astfits";
+ASTTABLE="$PREFIX/asttable";
+
+# astquery gaia --dataset=edr3 --center=24,25 --radius=0.1 --output=gaia.fits
--column=ra,dec,parallax --quiet -i | awk '/[0-9]+/ {print $2}'
+
+_gnuastro_autocomplete_fits_hdu_read(){
+ $("$ASTFITS --quiet $1" | awk '{print $2}')
+}
+
+_gnuastro_autocomplete_fits_list(){
+
+}
+
+_gnuastro_autocomplete_column_read(){
+
+}
+
+_gnuastro_autocomplete_expect_number(){
+ # Prompt the user that this option only accepts a number
+}
+
+_gnuastro_fits_last_occurance(){
+ # The last FITS file in COMP_LINE
+
+}
+
+_gnuastro_file_last_occurance(){
+ # The last file name (.txt/.fits) in COMP_LINE
+}
+
+_gnuastro_asttable_completions(){
+
+
+
+ # TODO: @@
+ PROG_NAME="asttable";
+
+ PROG_ADDRESS="$PREFIX/$PROG_NAME";
# Initialize the completion response with null
COMPREPLY=();
@@ -16,20 +56,28 @@ _astcosmiccal_completions(){
local prev="${COMP_WORDS[COMP_CWORD-1]}";
# Create the array of options that need a fits file as input
- local infits=($(astcosmiccal --help | \
+ local infits=($($PROG_ADDRESS --help | \
awk 'match($0,
/--([A-Z]|[a-z]|[0-9])*=FITS/) {print substr($0, RSTART, RLENGTH-4)}'));
+# case "$1" in
+# -h|--hdu)
+# # default case
+# *) ;;
+# esac
+
# Add completion suggestions for special options
if [ $prev = "--lineatz" ]; then
# Show all sub options in "lineatz"
- COMPREPLY+=($(compgen -W "$(astcosmiccal --listlines | \
+ COMPREPLY+=($(compgen -W "$($PREFIX/$PROG_NAME --listlines | \
awk '!/^#/ {print $2}') " \
-- "$word"));
fi
# Add completion suggestions for general options
if [[ "${infits[@]}" =~ "$prev" ]]; then
+
# Check if the previous word exists in the "infits" array
+ # Look into 'gal_fits_name_is_fits' function for acceptable suffixes
COMPREPLY+=($(compgen -f -X "!*.[fF][iI][tT][sS]"));
else
# Show all options in CosmicCalculator:
@@ -39,4 +87,4 @@ _astcosmiccal_completions(){
fi;
}
-complete -F _astcosmiccal_completions astcosmiccal
+complete -F _asttable_completions asttable
- [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 <=
- [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, 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