Doc and examples for multi-dot directory traversal

This commit is contained in:
NotTheDr01ds 2024-08-01 14:28:49 -04:00
parent 4157ca711d
commit 7ec20cfac0
3 changed files with 21 additions and 1 deletions

View File

@ -134,7 +134,7 @@ impl Command for Cd {
result: None, result: None,
}, },
Example { Example {
description: "Change to the previous working directory ($OLDPWD)", description: r#"Change to the previous working directory (same as "cd $env.OLDPWD")"#,
example: r#"cd -"#, example: r#"cd -"#,
result: None, result: None,
}, },
@ -143,6 +143,16 @@ impl Command for Cd {
example: r#"def --env gohome [] { cd ~ }"#, example: r#"def --env gohome [] { cd ~ }"#,
result: None, result: None,
}, },
Example {
description: "Move two directories up in the tree (the parent directory's parent). Additional dots can be added for additional levels.",
example: r#"cd ..."#,
result: None,
},
Example {
description: "The cd command itself is often optional. Simply entering a path to a directory will cd to it.",
example: r#"/home"#,
result: None,
},
] ]
} }
} }

View File

@ -99,6 +99,11 @@ impl Command for UCp {
example: "cp --preserve [] a b", example: "cp --preserve [] a b",
result: None, result: None,
}, },
Example {
description: "Copy file to a directory three levels above its current location",
example: "cp myfile ....",
result: None,
},
] ]
} }

View File

@ -40,6 +40,11 @@ impl Command for UMv {
example: "mv *.txt my/subdirectory", example: "mv *.txt my/subdirectory",
result: None, result: None,
}, },
Example {
description: r#"Move a file into the "my" directory two levels up in the directory tree"#,
example: "mv test.txt .../my/",
result: None,
},
] ]
} }