[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 51daecd 30/62: Table: Completion, update copyr
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 51daecd 30/62: Table: Completion, update copyright, minor edits |
Date: |
Thu, 13 May 2021 22:20:49 -0400 (EDT) |
branch: master
commit 51daecd1f04ecf1167e176d7f66e307fe8ce94b0
Author: Pedram Ashofteh Ardakani <pedramardakani@pm.me>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Table: Completion, update copyright, minor edits
With this commit, the copyright notice is updated with the same format
as all the other files in the Gnuastro program. Also, there were minor
changes to comments. I will update the Gnuastro manual with a
documentation and description of the autocomplete feature in future
commits.
---
bin/table/completion.sh | 50 +++++++++++++++++++++++++++++--------------------
1 file changed, 30 insertions(+), 20 deletions(-)
diff --git a/bin/table/completion.sh b/bin/table/completion.sh
index af0d5e0..050d8c3 100644
--- a/bin/table/completion.sh
+++ b/bin/table/completion.sh
@@ -1,10 +1,27 @@
-#!/usr/bin/env bash
-
-# TODO: GNU Copyright ...
-# Original Author:
-# Pedram Ashofteh Ardakani <pedramardakani@pm.me>
-# Contributing authors:
-# Mohammad Akhlaghi <mohammad@akhlaghi.org>
+#!/usr/bin bash
+
+# Add bash autocompletion to Gnuastro. This shell script is intended to
+# load itself automatically from the '~/.bashrc' file, modified during
+# installation. For more details, see the 'autocomplete feature' under the
+# 'developing' section of Gnuastro's manual and the comments below.
+#
+# Original author:
+# Pedram Ashofteh Ardakani <pedramardakani@pm.me>
+# Contributing author(s):
+# Copyright (C) 2019-2021, Free Software Foundation, Inc.
+#
+# Gnuastro is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# Gnuastro is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
# A thought on short options. I thing they should not be covered by the
# autocompletion. Because only the advanced users may use them. And it is
@@ -27,9 +44,6 @@
# '[[ =~', 'complete', arrays, etc. are not POSIX compatible. But they are bash
# built-in.
-# TODO: There should be some way to keep autocomplete from crashing in
-# older systems.
-
# TIP: Run the command below to initialize the bash completion feature for
# this specific program (i.e. astcosmiccal):
# $ source astcosmiccal-completion.bash
@@ -160,9 +174,6 @@ _gnuastro_autocomplete_get_file(){
echo "Pass"
}
-# just find the short commands
-# astconvolve --help | awk -v pattern="^ *-([a-z]|[A-Z])" 'match($0, pattern)
{print $0}'
-
_gnuastro_autocomplete_list_options(){
# Accept the command name and its absolute path, run the --help option
# and 'append' all long options to the current suggestions. 'Appending'
@@ -176,7 +187,6 @@ _gnuastro_autocomplete_list_options(){
}
_gnuastro_asttable_completions(){
-
# TODO: @@
PROG_NAME="asttable";
@@ -259,13 +269,13 @@ _gnuastro_asttable_completions(){
esac
if [[ ! "${COMPREPLY[@]}" =~ "=" ]]; then
- # '[[' and 'compopt' work for bash 3+ so it should be portable to
- # systems younger than 2004.
- # https://mywiki.wooledge.org/BashFAQ/061
+ # Do not append 'space' character to the end of line in case there
+ # is a long option present in the suggestions. Please note that
+ # long options always have a '=' suffix.
compopt +o nospace
fi
- # Debugging purpose:
+ # Be verbose in debugging mode, where $db is set to '0'.
if [ $db -eq 0 ]; then
cat <<EOF
@@ -277,8 +287,8 @@ _gnuastro_asttable_completions(){
>>> COMPREPLY: '${COMPREPLY[@]}'
*******************************
EOF
- # Printf should stay outside the 'heredoc' to prevent an extra
- # newline. As a result, the cursor stays on the same line.
+ # Printf should stay outside the 'heredoc' above to prevent an
+ # extra newline. As a result, the cursor stays on the same line.
printf ">>> Line: %s" "$COMP_LINE"
fi
- [gnuastro-commits] master 9ea367b 16/62: Table: Completion, handle '=', do not append space, (continued)
- [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
- [gnuastro-commits] master 51daecd 30/62: Table: Completion, update copyright, minor edits,
Mohammad Akhlaghi <=
- [gnuastro-commits] master e690fc5 37/62: Bash completion: renamed fixed file to completion.bash, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 229ac51 41/62: /bin/table/completion.bash: Refactor code, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 50026ec 48/62: Auto-completion: Rename boolean query functions, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 8150e1c 50/62: Auto-completion: Refactor FITS related functions, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master afadccf 52/62: Auto-completion: Call ..._last_table where needed, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 90f08c2 53/62: Auto-completion: Refactor ..._is_table function, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 4598eba 54/62: Auto-completion: clean re-implementation for Table, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master 59669d9 61/62: Book: new section on known issues with Crop, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master b947f79 62/62: TAB completion: enabled in Fits program, Mohammad Akhlaghi, 2021/05/13
- [gnuastro-commits] master acf58c1 58/62: TAB completion: now supported in ConvertType and Convolve, Mohammad Akhlaghi, 2021/05/13