[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 39efeea 08/62: Table: First working completion
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 39efeea 08/62: Table: First working completion, general commands |
Date: |
Thu, 13 May 2021 22:20:45 -0400 (EDT) |
branch: master
commit 39efeea7c669028c30d4332a7cafec025dcc165f
Author: Pedram Ashofteh Ardakani <pedramardakani@pm.me>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Table: First working completion, general commands
* Until now, the completion.sh file would not execute without errors.
This commit fix the issues with boiler plate code.
---
bin/table/completion.sh | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/bin/table/completion.sh b/bin/table/completion.sh
index 91c8ceb..e1fe499 100644
--- a/bin/table/completion.sh
+++ b/bin/table/completion.sh
@@ -44,12 +44,16 @@ _gnuastro_file_last_occurance(){
# just find the short commands
# 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)}'))
+}
+
_gnuastro_asttable_completions(){
# TODO: @@
- PROG_NAME="asttable";
+ local PROG_NAME="asttable";
- PROG_ADDRESS="$PREFIX/$PROG_NAME";
+ local PROG_ADDRESS="$PREFIX/$PROG_NAME";
# Initialize the completion response with null
COMPREPLY=();
@@ -60,14 +64,16 @@ _gnuastro_asttable_completions(){
# Variable "prev" is the word just before the current word
local prev="${COMP_WORDS[COMP_CWORD-1]}";
- case "$1" in
+ case "$word" in
-i|--information)
_gnuastro_autocomplete_fits_list_files
;;
-b|--noblank) ;;
-h|--hdu) ;;
# default case
- *) ;;
+ *) _gnuastro_autocomplete_list_all_options $PROG_NAME ;;
esac
-complete -F _asttable_completions asttable
+}
+
+complete -F _gnuastro_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, 2021/05/13
- [gnuastro-commits] master 39efeea 08/62: Table: First working completion, general commands,
Mohammad Akhlaghi <=
- [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, 2021/05/13