From 1601aa2f494a757de80f6da28803da05af53d00e Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Wed, 12 Aug 2020 13:21:19 -0400 Subject: [PATCH] Remove `with-symlink-targets` flag from `ls` (#2334) * Remove `with-symlink-targets` flag from `ls` * Fix test to use `ls -l` to output all the columns of `ls` * Fix error message * Delete test that originally covered `ls -w` --- crates/nu-cli/src/commands/ls.rs | 8 -------- crates/nu-cli/src/data/files.rs | 5 ++--- crates/nu-cli/src/shell/filesystem_shell.rs | 2 -- crates/nu-cli/tests/commands/ls.rs | 7 ------- 4 files changed, 2 insertions(+), 20 deletions(-) diff --git a/crates/nu-cli/src/commands/ls.rs b/crates/nu-cli/src/commands/ls.rs index ae3ac26ccd..0fc1023645 100644 --- a/crates/nu-cli/src/commands/ls.rs +++ b/crates/nu-cli/src/commands/ls.rs @@ -14,8 +14,6 @@ pub struct LsArgs { pub long: bool, #[serde(rename = "short-names")] pub short_names: bool, - #[serde(rename = "with-symlink-targets")] - pub with_symlink_targets: bool, #[serde(rename = "du")] pub du: bool, } @@ -44,12 +42,6 @@ impl WholeStreamCommand for Ls { "Only print the file names and not the path", Some('s'), ) - .switch( - // Delete this - "with-symlink-targets", - "Display the paths to the target files that symlinks point to", - Some('w'), - ) .switch( "du", "Display the apparent directory size in place of the directory metadata size", diff --git a/crates/nu-cli/src/data/files.rs b/crates/nu-cli/src/data/files.rs index 4bdeada8e1..ce93f55775 100644 --- a/crates/nu-cli/src/data/files.rs +++ b/crates/nu-cli/src/data/files.rs @@ -39,7 +39,6 @@ pub(crate) fn dir_entry_dict( tag: impl Into, long: bool, short_name: bool, - with_symlink_targets: bool, du: bool, ctrl_c: Arc, ) -> Result { @@ -71,7 +70,7 @@ pub(crate) fn dir_entry_dict( } } else { for column in ["name", "type", "target", "size", "modified"].iter() { - if *column == "target" && !with_symlink_targets { + if *column == "target" { continue; } dict.insert_untagged(*column, UntaggedValue::nothing()); @@ -97,7 +96,7 @@ pub(crate) fn dir_entry_dict( dict.insert_untagged("type", get_file_type(md)); } - if long || with_symlink_targets { + if long { if let Some(md) = metadata { if md.file_type().is_symlink() { let symlink_target_untagged_value: UntaggedValue; diff --git a/crates/nu-cli/src/shell/filesystem_shell.rs b/crates/nu-cli/src/shell/filesystem_shell.rs index 69dd2300d5..49be6fe11a 100644 --- a/crates/nu-cli/src/shell/filesystem_shell.rs +++ b/crates/nu-cli/src/shell/filesystem_shell.rs @@ -97,7 +97,6 @@ impl Shell for FilesystemShell { all, long, short_names, - with_symlink_targets, du, }: LsArgs, name_tag: Tag, @@ -166,7 +165,6 @@ impl Shell for FilesystemShell { name_tag.clone(), long, short_names, - with_symlink_targets, du, ctrl_c.clone(), ) diff --git a/crates/nu-cli/tests/commands/ls.rs b/crates/nu-cli/tests/commands/ls.rs index bbc907e72e..bf2a7767d7 100644 --- a/crates/nu-cli/tests/commands/ls.rs +++ b/crates/nu-cli/tests/commands/ls.rs @@ -173,13 +173,6 @@ fn list_all_columns() { ); let expected = ["name", "type", "size", "modified"].join(""); assert_eq!(actual.out, expected, "column names are incorrect for ls"); - // Symbolic Links - let actual = nu!( - cwd: dirs.test(), - "ls -w | get | to md" - ); - let expected = ["name", "type", "target", "size", "modified"].join(""); - assert_eq!(actual.out, expected, "column names are incorrect for ls -w"); // Long let actual = nu!( cwd: dirs.test(),