[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master d0e1362 14/62: Table: Completion, better funct
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master d0e1362 14/62: Table: Completion, better function name, copyright |
Date: |
Thu, 13 May 2021 22:20:46 -0400 (EDT) |
branch: master
commit d0e1362d30d422313e4a83269565bbb5e02e5c4b
Author: Pedram Ashofteh Ardakani <pedramardakani@pm.me>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Table: Completion, better function name, copyright
* Change function names that had both 'file' and 'fits' in it with
proper substitutes to prevent ambiguity.
* Add a placeholder for copyright, fill them out later.
---
bin/table/completion.sh | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/bin/table/completion.sh b/bin/table/completion.sh
index e74bb69..4caa021 100644
--- a/bin/table/completion.sh
+++ b/bin/table/completion.sh
@@ -1,5 +1,11 @@
#/usr/bin/env bash
+# TODO: GNU Copyright ...
+# Original Author:
+# Pedram Ashofteh Ardakani <pedramardakani@pm.me>
+# Contributing authors:
+# Mohammad Akhlaghi <mohammad@akhlaghi.org>
+
# TIP: Run the command below to initialize the bash completion feature for
# this specific program (i.e. astcosmiccal):
# $ source astcosmiccal-completion.bash
@@ -21,7 +27,7 @@ _gnuastro_autocomplete_fits_hdu_read(){
COMPREPLY=($("$ASTFITS --quiet $1" | awk '{print $2}'))
}
-_gnuastro_autocomplete_list_fits_files(){
+_gnuastro_autocomplete_list_fits_names(){
# Suggest all 'FITS' files in current directory. Case insensitive.
COMPREPLY=($(compgen -f -X "!*.[fF][iI][tT][sS]" -- "$word"))
}
@@ -31,10 +37,10 @@ _gnuastro_autocomplete_expect_number(){
echo "Pass"
}
-_gnuastro_autocomplete_get_fits_file(){
+_gnuastro_autocomplete_get_fits_name(){
# Get the first fits file among the command line
# TODO: Add all other fits file extensions
- comp_fits_file="$(echo ${COMP_WORDS[@]} | \
+ comp_fits_name="$(echo ${COMP_WORDS[@]} | \
awk -v regex="([a-z]|[A-Z])*.[fF][iI][tT][sS]" \
'match($0, regex) \
{print substr($0, RSTART, RLENGTH)}')"
@@ -43,12 +49,12 @@ _gnuastro_autocomplete_get_fits_file(){
_gnuastro_autocomplete_list_fits_columns(){
# Get the fits file name in current command line, put into
# the $comp_fits_file variable
- _gnuastro_autocomplete_get_fits_file
+ _gnuastro_autocomplete_get_fits_name
# If the fits file does exist, fetch its column names
- if [[ -f "$comp_fits_file" ]]; then
+ if [[ -f "$comp_fits_name" ]]; then
# Set a global array named comp_fits_columns that contains all columns
# inside the fits file specified in the first argument: $1.
- comp_fits_columns=("$($ASTTABLE --information $comp_fits_file | \
+ comp_fits_columns=("$($ASTTABLE --information $comp_fits_name | \
awk -v regex="^[0-9]+" \
'match($0, regex) \
{print $2}')")
@@ -64,7 +70,7 @@ _gnuastro_autocomplete_get_file(){
# just find the short commands
# astconvolve --help | awk -v pattern="^ *-([a-z]|[A-Z])" 'match($0, pattern)
{print $0}'
-_gnuastro_autocomplete_list_all_options(){
+_gnuastro_autocomplete_list_options(){
# 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 | \
@@ -92,11 +98,12 @@ _gnuastro_asttable_completions(){
# TODO: Prettify the code syntax, shorter ones on top
case "$prev" in
- -i|--information) _gnuastro_autocomplete_list_fits_files ;;
+ -i|--information) _gnuastro_autocomplete_list_fits_names ;;
-c|--column) _gnuastro_autocomplete_list_fits_columns ;;
+ -w|--wcsfile) _gnuastro_autocomplete_list_fits_names ;;
-b|--noblank) ;;
-h|--hdu) ;;
- *) _gnuastro_autocomplete_list_all_options $PROG_NAME ;;
+ *) _gnuastro_autocomplete_list_options $PROG_NAME ;;
esac
}
- [gnuastro-commits] master 39efeea 08/62: Table: First working completion, general commands, (continued)
- [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
- [gnuastro-commits] master d0e1362 14/62: Table: Completion, better function name, copyright,
Mohammad Akhlaghi <=
- [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
- [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