Skip to content

Problem filtering *not* readonly files #1119

Closed

Description

@danmx

Describe the bug
Following this: https://github.com/nushell/nushell/blob/f10390b/docs/commands/where.md#boolean-check
I'm trying to list not readonly files and I'm running into different weird error messages or missing outputs.

It seems that readonly is not matched properly.

To Reproduce

> ls --full
━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━
 #  │ name        │ type      │ readonly │ mode      │ size    │ created       │ accessed      │ modified
────┼─────────────┼───────────┼──────────┼───────────┼─────────┼───────────────┼───────────────┼───────────────
  0 │ cmd         │ Directory │ No       │ rwxr-xr-x │   160 B │ 10 months ago │ 9 months ago  │ 10 months ago
  1 │ Gopkg.toml  │ File      │ No       │ rw-r--r-- │  1.8 KB │ 10 months ago │ 10 months ago │ 10 months ago
  2 │ LICENSE     │ File      │ No       │ rw-r--r-- │ 11.3 KB │ 10 months ago │ 10 months ago │ 10 months ago
  3 │ config      │ Directory │ No       │ rwxr-xr-x │    96 B │ 10 months ago │ 9 months ago  │ 10 months ago
  4 │ Dockerfile  │ File      │ No       │ rw-r--r-- │   473 B │ 10 months ago │ 10 months ago │ 10 months ago
  5 │ Makefile    │ File      │ No       │ rw-r--r-- │  1.0 KB │ 10 months ago │ 10 months ago │ 10 months ago
  6 │ deploy      │ Directory │ No       │ rwxr-xr-x │   224 B │ 10 months ago │ 9 months ago  │ 10 months ago
  7 │ charts      │ Directory │ No       │ rwxr-xr-x │    96 B │ 10 months ago │ 9 months ago  │ 10 months ago
  8 │ Gopkg.lock  │ File      │ No       │ rw-r--r-- │ 27.1 KB │ 10 months ago │ 10 months ago │ 10 months ago
  9 │ MAINTAINERS │ File      │ No       │ rw-r--r-- │   109 B │ 10 months ago │ 10 months ago │ 10 months ago
 10 │ README.md   │ File      │ No       │ rw-r--r-- │  5.0 KB │ 10 months ago │ 10 months ago │ 10 months ago
 11 │ .gitignore  │ File      │ No       │ rw-r--r-- │  1.4 KB │ 10 months ago │ 9 months ago  │ 10 months ago
 12 │ version     │ Directory │ No       │ rwxr-xr-x │    96 B │ 10 months ago │ 9 months ago  │ 10 months ago
 13 │ examples    │ Directory │ No       │ rwxr-xr-x │    96 B │ 10 months ago │ 9 months ago  │ 10 months ago
 14 │ .git        │ Directory │ No       │ rwxr-xr-x │   416 B │ 10 months ago │ 10 months ago │ 10 months ago
 15 │ tmp         │ Directory │ No       │ rwxr-xr-x │   128 B │ 10 months ago │ 9 months ago  │ 10 months ago
 16 │ main.go     │ File      │ No       │ rw-r--r-- │   149 B │ 10 months ago │ 10 months ago │ 10 months ago
 17 │ vendor      │ Directory │ No       │ rwxr-xr-x │   256 B │ 10 months ago │ 9 months ago  │ 10 months ago
 18 │ pkg         │ Directory │ No       │ rwxr-xr-x │   192 B │ 10 months ago │ 9 months ago  │ 10 months ago
━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━

Now I'm trying to get the same output but with using | where. Here are couple of my attempts:

> ls --full | where readonly == No
error: Coercion error
- shell:1:18
1 | ls --full | where readonly == No
  |                   ^^^^^^^^ boolean
- shell:1:30
1 | ls --full | where readonly == No
  |                               -- string
> ls --full | where readonly == false
error: Coercion error
- shell:1:18
1 | ls --full | where readonly == false
  |                   ^^^^^^^^ boolean
- shell:1:30
1 | ls --full | where readonly == false
  |                               ----- string
> ls --full | where readonly != 1 == 1
error: Coercion error
- shell:1:18
1 | ls --full | where readonly != 1 == 1
  |                   ^^^^^^^^ boolean
- shell:1:30
1 | ls --full | where readonly != 1 == 1
  |                               ------ boolean
> ls --full | where readonly == 1 != 1
error: Coercion error
- shell:1:18
1 | ls --full | where readonly == 1 != 1
  |                   ^^^^^^^^ boolean
- shell:1:30
1 | ls --full | where readonly == 1 != 1
  |                               ------ boolean
> ls --full | where readonly == (1 != 1)
[no output]
> ls --full | where readonly == 0
error: Coercion error
- shell:1:18
1 | ls --full | where readonly == 0
  |                   ^^^^^^^^ boolean
- shell:1:30
1 | ls --full | where readonly == 0
  |                               - integer

Expected behavior
I would expect to see the same output as when using ls --full when using at least one of above examples.

Screenshots
If applicable, add screenshots to help explain your problem.

Configuration (please complete the following information):

  • OS: macOS
  • Version 0.6.1
  • Optional features (if any)

Add any other context about the problem here.

Activity

  1. thegedge commented on Apr 21, 2020

    @thegedge
    Contributor

    @danmx you should be able to do this in the next release:

    ls --full | where readonly
    

    or

    ls --full | where readonly == $false
    
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions