From 9819ed761e8038d16aedad3fe520efc7de00bea3 Mon Sep 17 00:00:00 2001 From: Evgenii Alekseev Date: Thu, 4 Apr 2024 13:33:03 +0300 Subject: [PATCH] Release 2.13.5 --- package/archlinux/PKGBUILD | 2 +- .../bash-completion/completions/_ahriman | 45 ++++++++++--------- package/share/man/man1/ahriman.1 | 2 +- package/share/zsh/site-functions/_ahriman | 10 ++++- src/ahriman/__init__.py | 2 +- 5 files changed, 37 insertions(+), 24 deletions(-) diff --git a/package/archlinux/PKGBUILD b/package/archlinux/PKGBUILD index c132f535..b93e0fce 100644 --- a/package/archlinux/PKGBUILD +++ b/package/archlinux/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Evgeniy Alekseev pkgname='ahriman' -pkgver=2.13.4 +pkgver=2.13.5 pkgrel=1 pkgdesc="ArcH linux ReposItory MANager" arch=('any') diff --git a/package/share/bash-completion/completions/_ahriman b/package/share/bash-completion/completions/_ahriman index e7de6870..e18c4d4b 100644 --- a/package/share/bash-completion/completions/_ahriman +++ b/package/share/bash-completion/completions/_ahriman @@ -584,7 +584,7 @@ _set_new_action() { current_action_nargs=1 fi - current_action_args_start_index=$(( $word_index + 1 )) + current_action_args_start_index=$(( $word_index + 1 - $pos_only )) current_action_is_positional=$2 } @@ -611,6 +611,7 @@ _shtab_ahriman() { local prefix=_shtab_ahriman local word_index=0 + local pos_only=0 # "--" delimeter not encountered yet _set_parser_defaults word_index=1 @@ -619,26 +620,30 @@ _shtab_ahriman() { while [ $word_index -ne $COMP_CWORD ]; do local this_word="${COMP_WORDS[$word_index]}" - if [[ -n $sub_parsers && " ${sub_parsers[@]} " == *" ${this_word} "* ]]; then - # valid subcommand: add it to the prefix & reset the current action - prefix="${prefix}_$(_shtab_replace_nonword $this_word)" - _set_parser_defaults - fi + if [[ $pos_only = 1 || " $this_word " != " -- " ]]; then + if [[ -n $sub_parsers && " ${sub_parsers[@]} " == *" ${this_word} "* ]]; then + # valid subcommand: add it to the prefix & reset the current action + prefix="${prefix}_$(_shtab_replace_nonword $this_word)" + _set_parser_defaults + fi - if [[ " ${current_option_strings[@]} " == *" ${this_word} "* ]]; then - # a new action should be acquired (due to recognised option string or - # no more input expected from current action); - # the next positional action can fill in here - _set_new_action $this_word false - fi + if [[ " ${current_option_strings[@]} " == *" ${this_word} "* ]]; then + # a new action should be acquired (due to recognised option string or + # no more input expected from current action); + # the next positional action can fill in here + _set_new_action $this_word false + fi - if [[ "$current_action_nargs" != "*" ]] && \ - [[ "$current_action_nargs" != "+" ]] && \ - [[ "$current_action_nargs" != *"..." ]] && \ - (( $word_index + 1 - $current_action_args_start_index >= \ - $current_action_nargs )); then - $current_action_is_positional && let "completed_positional_actions += 1" - _set_new_action "pos_${completed_positional_actions}" true + if [[ "$current_action_nargs" != "*" ]] && \ + [[ "$current_action_nargs" != "+" ]] && \ + [[ "$current_action_nargs" != *"..." ]] && \ + (( $word_index + 1 - $current_action_args_start_index - $pos_only >= \ + $current_action_nargs )); then + $current_action_is_positional && let "completed_positional_actions += 1" + _set_new_action "pos_${completed_positional_actions}" true + fi + else + pos_only=1 # "--" delimeter encountered fi let "word_index+=1" @@ -646,7 +651,7 @@ _shtab_ahriman() { # Generate the completions - if [[ "${completing_word}" == -* ]]; then + if [[ $pos_only = 0 && "${completing_word}" == -* ]]; then # optional argument started: use option strings COMPREPLY=( $(compgen -W "${current_option_strings[*]}" -- "${completing_word}") ) else diff --git a/package/share/man/man1/ahriman.1 b/package/share/man/man1/ahriman.1 index 0d028ac1..2c6b821b 100644 --- a/package/share/man/man1/ahriman.1 +++ b/package/share/man/man1/ahriman.1 @@ -1,4 +1,4 @@ -.TH AHRIMAN "1" "2024\-02\-09" "ahriman" "Generated Python Manual" +.TH AHRIMAN "1" "2024\-04\-04" "ahriman" "Generated Python Manual" .SH NAME ahriman .SH SYNOPSIS diff --git a/package/share/zsh/site-functions/_ahriman b/package/share/zsh/site-functions/_ahriman index 5ebe47c9..eb2efb80 100644 --- a/package/share/zsh/site-functions/_ahriman +++ b/package/share/zsh/site-functions/_ahriman @@ -736,4 +736,12 @@ _shtab_ahriman() { typeset -A opt_args -_shtab_ahriman "$@" + +if [[ $zsh_eval_context[-1] == eval ]]; then + # eval/source/. command, register function for later + compdef _shtab_ahriman -N ahriman +else + # autoload from fpath, call function directly + _shtab_ahriman "$@" +fi + diff --git a/src/ahriman/__init__.py b/src/ahriman/__init__.py index 57434536..82b3e8fb 100644 --- a/src/ahriman/__init__.py +++ b/src/ahriman/__init__.py @@ -17,4 +17,4 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -__version__ = "2.13.4" +__version__ = "2.13.5"