From 5b3f7262b42692688f76362085299f9888197c29 Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Fri, 30 Aug 2024 21:25:56 +0200 Subject: [PATCH 1/5] Move completions file to ~/.local/share/bash-completion/completions Fix https://github.com/ivan-hc/AM/issues/903 --- APP-MANAGER | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/APP-MANAGER b/APP-MANAGER index 600b3d788..bc1e40a30 100755 --- a/APP-MANAGER +++ b/APP-MANAGER @@ -303,7 +303,8 @@ function _completion_lists() { } # BASH AND ZSH COMPLETION -completion_file="${ZDOTDIR:-$HOME}"/.bash_completion +mkdir -p "$DATADIR/bash-completion/completions" +completion_file="${ZDOTDIR:-$DATADIR}/bash-completion/completions/am" if ! grep -qo " $AMCLI$" "$completion_file" >/dev/null 2>&1; then echo "complete -W \"\$(cat $AMDATADIR/list 2>/dev/null)\" $AMCLI" >> "$completion_file" if [ -f "${ZDOTDIR:-$HOME}"/.zshrc ] && echo "$SHELL" | grep -q "zsh"; then From c0652b4b67565f34af3b417848d166b97034bdd8 Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Fri, 30 Aug 2024 22:07:27 +0200 Subject: [PATCH 2/5] Remove "AMCLI" from previous completion file ...to prevent it from taking priority over the new one --- APP-MANAGER | 1 + 1 file changed, 1 insertion(+) diff --git a/APP-MANAGER b/APP-MANAGER index bc1e40a30..ceec86e27 100755 --- a/APP-MANAGER +++ b/APP-MANAGER @@ -305,6 +305,7 @@ function _completion_lists() { # BASH AND ZSH COMPLETION mkdir -p "$DATADIR/bash-completion/completions" completion_file="${ZDOTDIR:-$DATADIR}/bash-completion/completions/am" +[ -f "${ZDOTDIR:-$HOME}"/.bash_completion ] && sed -i "/ $AMCLI$/d" "${ZDOTDIR:-$HOME}"/.bash_completion if ! grep -qo " $AMCLI$" "$completion_file" >/dev/null 2>&1; then echo "complete -W \"\$(cat $AMDATADIR/list 2>/dev/null)\" $AMCLI" >> "$completion_file" if [ -f "${ZDOTDIR:-$HOME}"/.zshrc ] && echo "$SHELL" | grep -q "zsh"; then From c001552b68e2b2e127aed82d9a07cdf528b33f72 Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Sat, 31 Aug 2024 21:16:30 +0200 Subject: [PATCH 3/5] Update APP-MANAGER --- APP-MANAGER | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/APP-MANAGER b/APP-MANAGER index ceec86e27..cf031c448 100755 --- a/APP-MANAGER +++ b/APP-MANAGER @@ -303,10 +303,10 @@ function _completion_lists() { } # BASH AND ZSH COMPLETION -mkdir -p "$DATADIR/bash-completion/completions" -completion_file="${ZDOTDIR:-$DATADIR}/bash-completion/completions/am" -[ -f "${ZDOTDIR:-$HOME}"/.bash_completion ] && sed -i "/ $AMCLI$/d" "${ZDOTDIR:-$HOME}"/.bash_completion -if ! grep -qo " $AMCLI$" "$completion_file" >/dev/null 2>&1; then +completion_file="$DATADIR/bash-completion/completions/am" +mkdir -p "$DATADIR/bash-completion/completions" || exit 1 +[ -f "$HOME"/.bash_completion ] && sed -i "/ $AMCLI$/d" "$HOME"/.bash_completion +if ! grep -o " $AMCLI$" "$completion_file" >/dev/null 2>&1; then echo "complete -W \"\$(cat $AMDATADIR/list 2>/dev/null)\" $AMCLI" >> "$completion_file" if [ -f "${ZDOTDIR:-$HOME}"/.zshrc ] && echo "$SHELL" | grep -q "zsh"; then cat <<-HEREDOC >> "${ZDOTDIR:-$HOME}"/.zshrc From f0f9d5943bcb5b86b639ca70779b092b04193f63 Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Sun, 1 Sep 2024 01:32:07 +0200 Subject: [PATCH 4/5] Update APP-MANAGER --- APP-MANAGER | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/APP-MANAGER b/APP-MANAGER index cf031c448..2329a9fb5 100755 --- a/APP-MANAGER +++ b/APP-MANAGER @@ -1,6 +1,6 @@ #!/usr/bin/env bash -AMVERSION="8.1" +AMVERSION="8.1.1" # Determine main repository and branch AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main" From 531cd2b82bc4bc47ffe984be313792e67ff03f0d Mon Sep 17 00:00:00 2001 From: iVAN <88724353+ivan-hc@users.noreply.github.com> Date: Sun, 1 Sep 2024 01:39:08 +0200 Subject: [PATCH 5/5] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 0f5b17ffd..63568b932 100644 --- a/README.md +++ b/README.md @@ -1040,9 +1040,7 @@ EXTRA: The behavior of this option can be tested in a completely standalone way __________________________________________________________________________ ### How to enable bash completion -From version 8, BASH/ZSH completion is enabled in "AM" and "AppMan" by default. - -A file $HOME/.bash_completion will be created, or if it exists, it will be patched to allow the command `am` or `appman` to read arguments from the related "list" of arguments, or other lists, to made it more extensible. +**From version 8**, BASH/ZSH completion is enabled in "AM" and "AppMan" by default. and **from version 8.1.1** a file $HOME/.local/share/bash-completion/completions/am (and no more $HOME/.bash_completion) will be created and shared by both `am` and `appman` to read arguments from the related "list" of arguments, or other lists, to made it more extensible. Before version 8, in "AM" were created a "/etc/bash_completion.d/am-completion.sh" using a dedicated option.