mirror of
https://github.com/nushell/nushell.git
synced 2025-03-26 15:26:51 +01:00
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`
This commit is contained in:
parent
88555860f3
commit
1601aa2f49
@ -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",
|
||||
|
@ -39,7 +39,6 @@ pub(crate) fn dir_entry_dict(
|
||||
tag: impl Into<Tag>,
|
||||
long: bool,
|
||||
short_name: bool,
|
||||
with_symlink_targets: bool,
|
||||
du: bool,
|
||||
ctrl_c: Arc<AtomicBool>,
|
||||
) -> Result<Value, ShellError> {
|
||||
@ -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;
|
||||
|
@ -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(),
|
||||
)
|
||||
|
@ -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(),
|
||||
|
Loading…
Reference in New Issue
Block a user