mirror of
https://github.com/nushell/nushell
synced 2024-12-25 12:33:17 +00:00
Fix column bugs associated with previous refactoring (#1705)
* Fix: the symlink target column will only dispaly if either the `full` or `with_symlink_targets` options are given * If the metadata for every item in the size column is None, do not show the size column * Do not show the symlink target column if the metadata is None for all the items in the table
This commit is contained in:
parent
d7d487de73
commit
81ff598d6c
1 changed files with 8 additions and 8 deletions
|
@ -65,10 +65,10 @@ pub(crate) fn dir_entry_dict(
|
|||
dict.insert_untagged("type", UntaggedValue::nothing());
|
||||
}
|
||||
|
||||
let mut symlink_target_untagged_value: UntaggedValue = UntaggedValue::nothing();
|
||||
|
||||
if full || with_symlink_targets {
|
||||
if let Some(md) = metadata {
|
||||
let mut symlink_target_untagged_value: UntaggedValue = UntaggedValue::nothing();
|
||||
|
||||
if md.file_type().is_symlink() {
|
||||
if let Ok(path_to_link) = filename.read_link() {
|
||||
symlink_target_untagged_value =
|
||||
|
@ -78,11 +78,11 @@ pub(crate) fn dir_entry_dict(
|
|||
UntaggedValue::string("Could not obtain target file's path");
|
||||
}
|
||||
}
|
||||
|
||||
dict.insert_untagged("target", symlink_target_untagged_value);
|
||||
}
|
||||
}
|
||||
|
||||
dict.insert_untagged("target", symlink_target_untagged_value);
|
||||
|
||||
if full {
|
||||
if let Some(md) = metadata {
|
||||
dict.insert_untagged(
|
||||
|
@ -124,9 +124,9 @@ pub(crate) fn dir_entry_dict(
|
|||
}
|
||||
}
|
||||
|
||||
let mut size_untagged_value: UntaggedValue = UntaggedValue::nothing();
|
||||
|
||||
if let Some(md) = metadata {
|
||||
let mut size_untagged_value: UntaggedValue = UntaggedValue::nothing();
|
||||
|
||||
if md.is_dir() {
|
||||
let dir_size: u64 = if du {
|
||||
let params = DirBuilder::new(
|
||||
|
@ -153,9 +153,9 @@ pub(crate) fn dir_entry_dict(
|
|||
size_untagged_value = UntaggedValue::bytes(symlink_md.len() as u64);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dict.insert_untagged("size", size_untagged_value);
|
||||
dict.insert_untagged("size", size_untagged_value);
|
||||
}
|
||||
|
||||
if let Some(md) = metadata {
|
||||
if full {
|
||||
|
|
Loading…
Reference in a new issue