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

Re: Numeric version of ZSH_VERSION?



Ok -  Great. I'll use this.

By the way the -z option listed as an option under autoload is not
documented there. However this is written:
              Equivalent to "functions -u", with the exception of -X/+X and  -w.

which is a bit compressed in meaning. I gather it means two different
things. First that it does the same thing as "functions -u"  and
therefore second that it takes the same options as that, except those
mentioned. So third, you should look at "functions" to find out the
meaning of the unmentioned options.

Ok. So we then go to "functions" to try to figure out what "-z" does.
And along the way we've now picked up another option "-u" that we need
to understand.  Both "-z" and "-u" are listed again but not documented
in "functions" either.  However we get

    Equivalent to "typeset -f" with the exception ...

Okay so now we have to chase down a 3rd reference and have picked up
yet a third option to now understand: "-f".

typeset has a grab bag of options that have nothing to do with either
"functions -u" or "autoload". In fact the "-u" means something
different when combined with "-f" than it does when that's not there.


On Sat, Aug 30, 2008 at 11:16 PM, Dan Nelson <dnelson@xxxxxxxxxxxxxxx> wrote:
> In the last episode (Aug 30), Rocky Bernstein said:
>> It'd be nice to have a numeric version of ZSH_VERSION which is just a
>> monotonically increasing number. It would make testing for features in
>> (possibly open-ended) ranges easy.
>
> The Misc/is-at-least function should do what you need:
>
> OTHER FUNCTIONS
>  Descriptions
>  is-at-least needed [ present ]
>    Perform a greater-than-or-equal-to  comparison  of  two  strings
>    having  the format of a zsh version number; that is, a string of
>    numbers and text with segments separated by dots or dashes.   If
>    the  present string is not provided, $ZSH_VERSION is used.  Seg-
>    ments are paired left-to-right in the two strings  with  leading
>    non-number parts ignored.  If one string has fewer segments than
>    the other, the missing segments are considered zero.
>
>    This is useful in startup files to set options and  other  state
>    that are not available in all versions of zsh.
>
>      is-at-least 3.1.6-15 && setopt NO_GLOBAL_RCS
>      is-at-least 3.1.0 && setopt HIST_REDUCE_BLANKS
>      is-at-least 2.6-17 || print "You can't use is-at-least here."
>
>
> --
>        Dan Nelson
>        dnelson@xxxxxxxxxxxxxxx
>



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