mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 14:38:57 +02:00
Port find
command (#658)
* Add `Find` command * Complete rustdoc for test `Value` constructors * Use `Option::unwrap_or` instead of match * Add `Value::test_filesize` constructor * Handle searching for terms in `find` * Fix `find` command signature * Return multiple elements when `find`ing by predicate * Do not accept rest parameter with predicate * Handle `CellPath` in `r#in` and `not_in` for `Find` * Use `PipelineData::filter`
This commit is contained in:
@ -8,6 +8,16 @@ pub enum PathMember {
|
||||
Int { val: usize, span: Span },
|
||||
}
|
||||
|
||||
impl PartialEq for PathMember {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(Self::String { val: l_val, .. }, Self::String { val: r_val, .. }) => l_val == r_val,
|
||||
(Self::Int { val: l_val, .. }, Self::Int { val: r_val, .. }) => l_val == r_val,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct CellPath {
|
||||
pub members: Vec<PathMember>,
|
||||
|
Reference in New Issue
Block a user