Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [RFC PATCH 1/2] complete absolute paths for mpc add



I didn't see this the first time around for some reason.

On Fri, Sep 27, 2024 at 9:34 AM Karel Balej <balejk@xxxxxxxxx> wrote:
>
> +(( $+functions[_mpc_helper_all_files] )) ||
> +_mpc_helper_all_files() {
> +  if [[ $words[CURRENT] == [/~]* ]]; then
> +         _files
> +  fi
> +  _mpc_helper_files
> +}

If _files succeeds ($? == 0) but _mpc_helper_files fails ($? != 0)
then _mpc_helper_all_files will appear to fail and completion will
proceed to the next possible alternative.

Does something like the following still give the result you expect?

_mpc_helper_all_files() {
  local ret=1
  if [[ $words[CURRENT] == [/~]* ]]; then
         _files
         ret=$?
  fi
  _mpc_helper_files || return ret
}




Messages sorted by: Reverse Date, Date, Thread, Author