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

Re: _time_zone gives me candidates other than timezones



I like Jun's solution. I still have reservations about completing right/
and posix/ (they could be flags instead to the calling program). But the
difference isn't a really big one.

That said I did write a big email about it and I think I only sent it to
Aaron Schrab (sorry). So now I'm quoting it here and actually CC'ing the list

>I guess it comes down to whether you call _time_zone to find a zoneinfo
>/file/ or a timezone /name/.
>
>If you're just completing the name of a timezone then whether the name
>of the timezone refers to a `right` timezone or a `posix` timezone seems
>like it could be better handled by the programmer calling
>_time_zone. After all the names under right/ and posix/ are identical so
>the directory prefix only adds a bit of semantic information, which
>would probably be better handled as an argument somehwere beforehand
>rather than parsed out later.
>
>If you're calling _time_zone to complete zoneinfo files themselves then
>excluding posix/ and right/ is wrong since each directory houses
>different files and so their differences can't be easily accounted for
>otherwise. But if you're completing filenames you'd also need to recover
>the prefix which is lost when using -W as is used now.
>
>> I'm a bit more puzzled about why the separate `posix` directory exists. 
>> At least for my local time zone it doesn't seem to matter if I use that 
>> or leave it out; while using the `right` one definitely makes a 
>> difference:
>Yeah, I get the same behavior on my system.
>
>So, no I wasn't aware of the difference between right/ and posix/ but I
>also don't think their exclusion will matter since I think _time_zone is
>more for completing names by way of files and the files themselves are
>not relevant in this context.
>


"Jun. T" <takimoto-j@xxxxxxxxxxxxxxxxx> writes:

>> 2022/03/30 9:12, Aaron Schrab <aaron@xxxxxxxxxx> wrote:
>> 
>> While I don't think I've ever really needed to use zoneinfo entries from those directories, I'd certainly prefer they be offered for completion.
>
> How about this?
>
> diff --git a/Completion/Unix/Type/_time_zone b/Completion/Unix/Type/_time_zone
> index cd924bbc7..c437252a8 100644
> --- a/Completion/Unix/Type/_time_zone
> +++ b/Completion/Unix/Type/_time_zone
> @@ -6,4 +6,4 @@ if (( ! $+_zoneinfo_dirs )); then
>    _zoneinfo_dirs=( /usr/{share,lib,share/lib}/{zoneinfo*,locale/TZ}(/) )
>  fi
>  
> -_wanted time-zones expl 'time zone' _files -W _zoneinfo_dirs "$@" -
> +_wanted time-zones expl 'time zone' _files -g '[A-Z]*' -W _zoneinfo_dirs "$@" -




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