Skip to content

Support some saner switches for test #6065

Closed

Description

@mqudsi

I would like to add -gte and -lte as aliases for -ge and -le to test (even if undocumented).

Activity

  1. faho commented on Aug 25, 2019

    @faho
    Member

    Blergh.

    A single letter difference to still have a cryptic abbreviation does not seem good to me.

  2. mqudsi commented on Aug 25, 2019

    @mqudsi
    ContributorAuthor

    It's not so much to fix how cryptic it is so much as it is to make it compatible with other syntaxes.

  3. faho commented on Aug 25, 2019

    @faho
    Member

    Which other syntaxes? I've not seen "-gte" anywhere, ever?

    If this were actually much more understandable I'd be for it, but if you understand -gte you also understand -ge.

    Also if e.g. you wanted to find all greater-or-equal comparisons you'd now have one more thing to grep for, it's one more thing to learn if you read someone's script, it's one more possible point of accidental incompatibility with old fish versions...

  4. floam commented on Aug 25, 2019

    @floam
    Member

    I've accidentally tried test ... -gte before, but I'm not sure if that means there's a [ out there that takes it.

  5. mqudsi commented on Aug 25, 2019

    @mqudsi
    ContributorAuthor

    Those are fair points. I didn't mean compatible with other test implementations but rather with other abbreviations. ColdFusion-inspired things use it, such as conditional comments in HTML, and it's used a lot in data query languages.

  6. floam commented on Aug 25, 2019

    @floam
    Member

    Because I prefer in theory -gte over -ge and think the former is simply better, and because I've unsuccessfully tried stuff like [ $foo -gte 3 ] only to be disappointed, I'm inclined to agree with doing this. However I don't think it's a great idea to have two such similar ways of doing the same thing, particularly when incompatible with POSIX test, for little gain.

    This seems like a great place for a fishy error message that teaches.

    $ test 3 -gte 5
    test: unexpected argument '-gte': Use '-ge' for a greater-than or equal comparison
    

    In some more advanced universe, we might even prime autosuggestions with a version of the command line that would work (or rely on authoritative completions, which were removed long ago).

  7. faho commented on Aug 26, 2019

    @faho
    Member

    This seems like a great place for a fishy error message that teaches.

    That sounds completely okay to me.

  8. faho commented on Oct 31, 2019

    @faho
    Member

    Yeah let's go with a proper replacement for test, like zanchey's is (#6124), instead of putting lipstick on a pig.

  9. added this to the will-not-implement milestone on Nov 1, 2019
  10. locked as resolved and limited conversation to collaborators on Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions