Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: update macos completions
Thanks, this looks right. Turns out `trash` does in fact fail gracefully on unrecognized args:
> ~ % trash -s --xray -v foo
> # Un-recognized argument --xray at index 2
Yes, no -s and -S was intentional, I confirmed that stacking and -- don't work:
> tmp.CExG50tYnm % trash -sv
> # Un-recognized argument -sv at index 1
> tmp.CExG50tYnm % trash -v -- ccc
> # Moved "/private/var/folders/_d/j8xy7gpj06qfxtd4p_9kv2mw0000gn/T/tmp.CExG50tYnm/--" to "/Users/rrotter/.Trash/-- 14-29-24-212"
> # Moved "/private/var/folders/_d/j8xy7gpj06qfxtd4p_9kv2mw0000gn/T/tmp.CExG50tYnm/ccc" to "/Users/rrotter/.Trash/ccc"
Looks good to merge. Thanks for the feedback, improvements, and patience.
> On 5. Jun 2025, at 01:40, dana <dana@xxxxxxx> wrote:
>
> On Wed 4 Jun 2025, at 23:20, Ryan Rotter wrote:
>> - Add support for native macos trash command added in macOS 14.0 (per
>> `man trash`)
>
> in this one you copied and pasted some stuff from above that isn't needed /
> doesn't make sense, and the -A arg is wrong (no -s -S seems right though,
> typical ad-hoc argument parsing from apple). i'll commit with this tweak if
> that's ok
>
> On Wed 4 Jun 2025, at 23:20, Ryan Rotter wrote:
>> [I'd like to have _trash refuse to repeat filenames, just like
>> _git-add, but that's quite beyond my skill at this point]
>
> most functions are just like that, _git is an exception
>
> dana
>
>
> diff --git a/Completion/Unix/Command/_trash b/Completion/Unix/Command/_trash
> index 64ef69385..6315f218b 100644
> --- a/Completion/Unix/Command/_trash
> +++ b/Completion/Unix/Command/_trash
> @@ -54,19 +54,11 @@ case $variant in
> return
> ;;
> darwin)
> - local -a args=(
> - '(-v --verbose)'{-v,--verbose}'[display more verbose status]'
> -
> - + options
> - '(-s --stopOnError)'{-s,--stopOnError}'[exit with an error if any move to a trash folder fails]'
> -
> - + info
> - '(- *)'{-h,--help}'[display help information]'
> -
> - + input
> - '(actions)*: :_files'
> - )
> - _arguments -A : $args
> + _arguments -A '-*' : \
> + '(-v --verbose)'{-v,--verbose}'[display more verbose status]' \
> + '(-s --stopOnError)'{-s,--stopOnError}'[exit with error if any move to trash folder fails]' \
> + '(- *)'{-h,--help}'[display help information]' \
> + '*: :_files'
> return
> ;;
> *) _default ;;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author