feat: fix and update some examples (#4844)

This commit is contained in:
Justin Ma
2022-03-14 20:41:09 +08:00
committed by GitHub
parent 54d9fff4f2
commit 10d805c1fa
6 changed files with 46 additions and 2 deletions

View File

@ -224,6 +224,22 @@ impl Command for Ls {
example: "ls *.rs",
result: None,
},
Example {
description: "List all files and directories whose name do not contain 'bar'",
example: "ls -s | where name !~ bar",
result: None,
},
Example {
description: "List all dirs with full path name in your home directory",
example: "ls -f ~ | where type == dir",
result: None,
},
Example {
description:
"List all dirs in your home directory which have not been modified in 7 days",
example: "ls -s ~ | where type == dir && modified < ((date now) - 7day)",
result: None,
},
]
}
}

View File

@ -46,6 +46,14 @@ impl Command for Reduce {
span: Span::test_data(),
}),
},
Example {
example: "[ 1 2 3 ] | reduce -n {|it, acc| $acc + $it.item }",
description: "Sum values of a list (same as 'math sum')",
result: Some(Value::Int {
val: 6,
span: Span::test_data(),
}),
},
Example {
example: "[ 1 2 3 4 ] | reduce -f 10 {|it, acc| $acc + $it }",
description: "Sum values with a starting value (fold)",

View File

@ -96,7 +96,7 @@ impl Command for Where {
},
Example {
description: "List all files that were modified in the last two weeks",
example: "ls | where modified <= 2wk",
example: "ls | where modified >= (date now) - 2wk",
result: None,
},
]