From 4a82ee6c11634799979c412aac1b7fb546c58adb Mon Sep 17 00:00:00 2001 From: Hofer-Julian <30049909+Hofer-Julian@users.noreply.github.com> Date: Tue, 3 Oct 2023 20:41:41 +0200 Subject: [PATCH] Port command examples to long option (#10596) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Description Long options are preferable over short ones for documentation. This PR ports some command examples to exclusively use long options. # User-Facing Changes # Tests + Formatting ✅ # After Submitting --- crates/nu-command/src/filesystem/cp.rs | 6 +++--- crates/nu-command/src/filesystem/ucp.rs | 4 ++-- crates/nu-command/src/viewers/table.rs | 2 +- crates/nu-explore/src/explore.rs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/nu-command/src/filesystem/cp.rs b/crates/nu-command/src/filesystem/cp.rs index 82fc127f45..f5c79cb694 100644 --- a/crates/nu-command/src/filesystem/cp.rs +++ b/crates/nu-command/src/filesystem/cp.rs @@ -359,12 +359,12 @@ impl Command for Cp { }, Example { description: "Recursively copy dir_a to dir_b", - example: "cp -r dir_a dir_b", + example: "cp --recursive dir_a dir_b", result: None, }, Example { description: "Recursively copy dir_a to dir_b, and print the feedbacks", - example: "cp -r -v dir_a dir_b", + example: "cp --recursive --verbose dir_a dir_b", result: None, }, Example { @@ -374,7 +374,7 @@ impl Command for Cp { }, Example { description: "Copy only if source file is newer than target file", - example: "cp -u a b", + example: "cp --update a b", result: None, }, ] diff --git a/crates/nu-command/src/filesystem/ucp.rs b/crates/nu-command/src/filesystem/ucp.rs index a8603295ed..5c34c59412 100644 --- a/crates/nu-command/src/filesystem/ucp.rs +++ b/crates/nu-command/src/filesystem/ucp.rs @@ -68,12 +68,12 @@ impl Command for UCp { }, Example { description: "Recursively copy dir_a to dir_b", - example: "ucp -r dir_a dir_b", + example: "ucp --recursive dir_a dir_b", result: None, }, Example { description: "Recursively copy dir_a to dir_b, and print the feedbacks", - example: "ucp -r -v dir_a dir_b", + example: "ucp --recursive --verbose dir_a dir_b", result: None, }, Example { diff --git a/crates/nu-command/src/viewers/table.rs b/crates/nu-command/src/viewers/table.rs index 50acfa2d13..16b387f883 100644 --- a/crates/nu-command/src/viewers/table.rs +++ b/crates/nu-command/src/viewers/table.rs @@ -134,7 +134,7 @@ impl Command for Table { vec![ Example { description: "List the files in current directory, with indexes starting from 1.", - example: r#"ls | table -n 1"#, + example: r#"ls | table --start-number 1"#, result: None, }, Example { diff --git a/crates/nu-explore/src/explore.rs b/crates/nu-explore/src/explore.rs index e8f5ac6de7..ade3ee42e7 100644 --- a/crates/nu-explore/src/explore.rs +++ b/crates/nu-explore/src/explore.rs @@ -113,13 +113,13 @@ impl Command for Explore { }, Example { description: "Explore a list of Markdown files' contents, with row indexes", - example: r#"glob *.md | each {|| open } | explore -i"#, + example: r#"glob *.md | each {|| open } | explore --index"#, result: None, }, Example { description: "Explore a JSON file, then save the last visited sub-structure to a file", - example: r#"open file.json | explore -p | to json | save part.json"#, + example: r#"open file.json | explore --peek | to json | save part.json"#, result: None, }, ]