mirror of
https://github.com/nushell/nushell.git
synced 2024-11-07 09:04:18 +01:00
Update and add ls examples (#13222)
# Description Based on #13219, added several examples to `ls` doc to demonstrate recursive directory listings. List of changes in this PR: * Add example for `ls **/*` to demonstrate recursive listing using glob pattern * Add example for `ls ...(glob )`... to demonstrate recursive listing using glob command * Remove `-s` from an example where it had no use (since it was based on the current directory and was not recursive) * Update the description of `ls -a ~ `... to clarify that it lists the full path of directories * Update the description of `ls -as ~ `... (the difference being the `-s`) to clarify that it lists only the filenames, not paths. # User-Facing Changes Help only # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting N/A
This commit is contained in:
parent
020f4436d9
commit
58e8ea6084
@ -175,20 +175,32 @@ impl Command for Ls {
|
||||
},
|
||||
Example {
|
||||
description: "List files and directories whose name do not contain 'bar'",
|
||||
example: "ls -s | where name !~ bar",
|
||||
example: "ls | where name !~ bar",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "List all dirs in your home directory",
|
||||
description: "List the full path of all dirs in your home directory",
|
||||
example: "ls -a ~ | where type == dir",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description:
|
||||
"List all dirs in your home directory which have not been modified in 7 days",
|
||||
"List only the names (not paths) of all dirs in your home directory which have not been modified in 7 days",
|
||||
example: "ls -as ~ | where type == dir and modified < ((date now) - 7day)",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description:
|
||||
"Recursively list all files and subdirectories under the current directory using a glob pattern",
|
||||
example: "ls -a **/*",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description:
|
||||
"Recursively list *.rs and *.toml files using the glob command",
|
||||
example: "ls ...(glob **/*.{rs,toml})",
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "List given paths and show directories themselves",
|
||||
example: "['/path/to/directory' '/path/to/file'] | each {|| ls -D $in } | flatten",
|
||||
|
Loading…
Reference in New Issue
Block a user