Nushell: [Question] : what are the possible conditionals for the "where" command

Created on 20 Oct 2019  路  4Comments  路  Source: nushell/nushell

are there additional conditionals that can be used for the where command aside from ==, >, <

documentation good first issue question

Most helpful comment

I've been wondering about this too. I'd love a contains or regex match (=~?) for strings, but that doesn't seem possible at the moment.

All 4 comments

I've been wondering about this too. I'd love a contains or regex match (=~?) for strings, but that doesn't seem possible at the moment.

If someone points me how, I could add this.
So the where seems to have some SyntaxShape::Block with the condition? But in this file I don't understand whats happening
https://github.com/nushell/nushell/blob/388fc241914c11587006e32a872883428a75ccd3/src/parser/hir/syntax_shape/block.rs

I'd love to help out, but I'm not sure where to go either. If you look at src/data/base.rs you'll find an impl Block block which has an invoke function. Looks like this is used later on. Following on from that, in src/evaluate/evaluator.rs, you have the evaluate_baseline_expr, which evaluates expressions. It gets pretty abstract from there, but that might be a clue, at least.

Edit:
Here's the line using invoke from src/commands/where_.rs
GitHub link

// .... snip ...
            Tagged {
                item: Value::Block(block),
                ..
            } => {
                let result = block.invoke(&input_clone);
                match result {
// ... snip ...

This is now documented as part of the where command: https://www.nushell.sh/commands/where.html

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Zooce picture Zooce  路  5Comments

ne-on picture ne-on  路  5Comments

triclops200 picture triclops200  路  4Comments

coolshaurya picture coolshaurya  路  4Comments

KasMA1990 picture KasMA1990  路  4Comments