mirror of
https://github.com/nushell/nushell.git
synced 2025-04-10 14:08:40 +02: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,
|
pub long: bool,
|
||||||
#[serde(rename = "short-names")]
|
#[serde(rename = "short-names")]
|
||||||
pub short_names: bool,
|
pub short_names: bool,
|
||||||
#[serde(rename = "with-symlink-targets")]
|
|
||||||
pub with_symlink_targets: bool,
|
|
||||||
#[serde(rename = "du")]
|
#[serde(rename = "du")]
|
||||||
pub du: bool,
|
pub du: bool,
|
||||||
}
|
}
|
||||||
@ -44,12 +42,6 @@ impl WholeStreamCommand for Ls {
|
|||||||
"Only print the file names and not the path",
|
"Only print the file names and not the path",
|
||||||
Some('s'),
|
Some('s'),
|
||||||
)
|
)
|
||||||
.switch(
|
|
||||||
// Delete this
|
|
||||||
"with-symlink-targets",
|
|
||||||
"Display the paths to the target files that symlinks point to",
|
|
||||||
Some('w'),
|
|
||||||
)
|
|
||||||
.switch(
|
.switch(
|
||||||
"du",
|
"du",
|
||||||
"Display the apparent directory size in place of the directory metadata size",
|
"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>,
|
tag: impl Into<Tag>,
|
||||||
long: bool,
|
long: bool,
|
||||||
short_name: bool,
|
short_name: bool,
|
||||||
with_symlink_targets: bool,
|
|
||||||
du: bool,
|
du: bool,
|
||||||
ctrl_c: Arc<AtomicBool>,
|
ctrl_c: Arc<AtomicBool>,
|
||||||
) -> Result<Value, ShellError> {
|
) -> Result<Value, ShellError> {
|
||||||
@ -71,7 +70,7 @@ pub(crate) fn dir_entry_dict(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for column in ["name", "type", "target", "size", "modified"].iter() {
|
for column in ["name", "type", "target", "size", "modified"].iter() {
|
||||||
if *column == "target" && !with_symlink_targets {
|
if *column == "target" {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
dict.insert_untagged(*column, UntaggedValue::nothing());
|
dict.insert_untagged(*column, UntaggedValue::nothing());
|
||||||
@ -97,7 +96,7 @@ pub(crate) fn dir_entry_dict(
|
|||||||
dict.insert_untagged("type", get_file_type(md));
|
dict.insert_untagged("type", get_file_type(md));
|
||||||
}
|
}
|
||||||
|
|
||||||
if long || with_symlink_targets {
|
if long {
|
||||||
if let Some(md) = metadata {
|
if let Some(md) = metadata {
|
||||||
if md.file_type().is_symlink() {
|
if md.file_type().is_symlink() {
|
||||||
let symlink_target_untagged_value: UntaggedValue;
|
let symlink_target_untagged_value: UntaggedValue;
|
||||||
|
@ -97,7 +97,6 @@ impl Shell for FilesystemShell {
|
|||||||
all,
|
all,
|
||||||
long,
|
long,
|
||||||
short_names,
|
short_names,
|
||||||
with_symlink_targets,
|
|
||||||
du,
|
du,
|
||||||
}: LsArgs,
|
}: LsArgs,
|
||||||
name_tag: Tag,
|
name_tag: Tag,
|
||||||
@ -166,7 +165,6 @@ impl Shell for FilesystemShell {
|
|||||||
name_tag.clone(),
|
name_tag.clone(),
|
||||||
long,
|
long,
|
||||||
short_names,
|
short_names,
|
||||||
with_symlink_targets,
|
|
||||||
du,
|
du,
|
||||||
ctrl_c.clone(),
|
ctrl_c.clone(),
|
||||||
)
|
)
|
||||||
|
@ -173,13 +173,6 @@ fn list_all_columns() {
|
|||||||
);
|
);
|
||||||
let expected = ["name", "type", "size", "modified"].join("");
|
let expected = ["name", "type", "size", "modified"].join("");
|
||||||
assert_eq!(actual.out, expected, "column names are incorrect for ls");
|
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
|
// Long
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: dirs.test(),
|
cwd: dirs.test(),
|
||||||
|
Loading…
Reference in New Issue
Block a user