Skip to content

Parse boolean values #98

Closed
Closed

Description

@sophiajt

Would be nice to be able to do pass commands like where yanked != true though it currently seems that true is being parsed as a string.

Activity

  1. wycats commented on Aug 26, 2019

    @wycats
    Contributor

    PowerShell makes this work by reserving $true and $false. Earlier on, I was thinking $yes and $no. I'm open to other options.

  2. added
    status:needs-design
    on Aug 26, 2019
  3. rrichardson commented on Sep 4, 2019

    @rrichardson
    Contributor

    are there any characters/symbols already reserved in nushell? I am disinclined to use $ because it might be misleading to newcomers from bash|zsh|csh|etc
    I kind of like :true :false but am not set on it

  4. COLAMAroro commented on Oct 3, 2019

    @COLAMAroro

    Using $true and $false doesn't seems that bad, considering the use of $it when piping and the inspiration from PowerShell

  5. alexxbb commented on Jan 13, 2020

    @alexxbb

    What if we distinct a comparison with literals versus logical operation on values? i.e:
    ls | where type is File - literal
    ls | where size > 10kb - logical
    read something | where yanked != true - logical

  6. olamiko commented on Apr 25, 2020

    @olamiko

    I will like to handle this but which mode should I work with? $true or :true?

  7. rrichardson commented on Apr 25, 2020

    @rrichardson
    Contributor

    @olamiko - I think this feature was just released.

  8. thegedge commented on Apr 25, 2020

    @thegedge
    Contributor

    Yep, @jonathandturner added $true and $false:

    ❯ ls --full | where readonly
    ❯ ls --full | where readonly == $false
    

    There's currently no shorthand for boolean negation, so this doesn't work:

    ❯ ls --full | where !readonly
    
  9. added a commit that references this issue on Feb 7, 2022
  10. added a commit that references this issue on Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issuestatus:needs-design

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions