[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master b391ee8 22/62: Table: Completion, bash4+ long
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master b391ee8 22/62: Table: Completion, bash4+ long option no space |
Date: |
Thu, 13 May 2021 22:20:48 -0400 (EDT) |
branch: master
commit b391ee84886ce2a024f9e958b2cc2c9d30aa921f
Author: Pedram Ashofteh Ardakani <pedramardakani@pm.me>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Table: Completion, bash4+ long option no space
Until now, we used the 'nospace' option of 'complete' to handle
suggestions for options which had an '=' inside them. With this commit,
if the command being completed contains '=', no spaces will be appended.
This only works in bash4+ for '[[' and 'compopt' are used within this
approach. Let's just keep this here and look for a workaround in future
commits.
TODO: Work on compatibility for bash older than version 4.
---
bin/table/completion.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/bin/table/completion.sh b/bin/table/completion.sh
index 3c2bbc0..60c74eb 100644
--- a/bin/table/completion.sh
+++ b/bin/table/completion.sh
@@ -30,7 +30,7 @@
PREFIX="/usr/local/bin";
ASTFITS="$PREFIX/astfits";
ASTTABLE="$PREFIX/asttable";
-db=1 # Set 0 for printing debug messages, else set to 1
+db=0 # Set 0 for printing debug messages, else set to 1
# Use extended globs in the case statements if needed
# https://mywiki.wooledge.org/BashGuide/Patterns#Extended_Globs
# shopt -s extglob
@@ -189,6 +189,12 @@ _gnuastro_asttable_completions(){
*) _gnuastro_autocomplete_list_options $PROG_ADDRESS ;;
esac
+ if [[ ! "${COMPREPLY[@]}" =~ "=" ]]; then
+ # '[[' and 'compopt' work for bash 4+
+ # TODO: Find workaround for older bash
+ compopt +o nospace
+ fi
+
# Debugging purpose:
if [ $db -eq 0 ]; then
cat <<EOF
- [gnuastro-commits] master d631f5b 15/62: Table: Completion, remove global variables, etc, (continued)
- [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
- [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 <=
- [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
- [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