diff --git a/crates/nu-command/src/path/join.rs b/crates/nu-command/src/path/join.rs index 189fd7332..c870af1ed 100644 --- a/crates/nu-command/src/path/join.rs +++ b/crates/nu-command/src/path/join.rs @@ -90,6 +90,17 @@ the output of 'path parse' and 'path split' subcommands."# example: r"'C:\Users\viking' | path join spams this_spam.txt", result: Some(Value::test_string(r"C:\Users\viking\spams\this_spam.txt")), }, + Example { + description: "Use relative paths, e.g. '..' will go up one directory", + example: r"'C:\Users\viking' | path join .. folder", + result: Some(Value::test_string(r"C:\Users\viking\..\folder")), + }, + Example { + description: + "Use absolute paths, e.g. '/' will bring you to the top level directory", + example: r"'C:\Users\viking' | path join / folder", + result: Some(Value::test_string(r"C:/folder")), + }, Example { description: "Join a list of parts into a path", example: r"[ 'C:' '\' 'Users' 'viking' 'spam.txt' ] | path join", @@ -124,6 +135,17 @@ the output of 'path parse' and 'path split' subcommands."# example: r"'/home/viking' | path join spams this_spam.txt", result: Some(Value::test_string(r"/home/viking/spams/this_spam.txt")), }, + Example { + description: "Use relative paths, e.g. '..' will go up one directory", + example: r"'/home/viking' | path join .. folder", + result: Some(Value::test_string(r"/home/viking/../folder")), + }, + Example { + description: + "Use absolute paths, e.g. '/' will bring you to the top level directory", + example: r"'/home/viking' | path join / folder", + result: Some(Value::test_string(r"/folder")), + }, Example { description: "Join a list of parts into a path", example: r"[ '/' 'home' 'viking' 'spam.txt' ] | path join",