mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
Merge pull request #5675 from cakebaker/ls_rename_display_file_name
ls: rename `display_file_name` to `display_item_name`
This commit is contained in:
commit
5cc5aa70ce
1 changed files with 13 additions and 12 deletions
|
@ -2413,7 +2413,7 @@ fn display_items(
|
||||||
|
|
||||||
for i in items {
|
for i in items {
|
||||||
let more_info = display_additional_leading_info(i, &padding, config, out)?;
|
let more_info = display_additional_leading_info(i, &padding, config, out)?;
|
||||||
let cell = display_file_name(i, config, prefix_context, more_info, out, style_manager);
|
let cell = display_item_name(i, config, prefix_context, more_info, out, style_manager);
|
||||||
names_vec.push(cell);
|
names_vec.push(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2544,11 +2544,11 @@ fn display_grid(
|
||||||
/// * `author` ([`display_uname`], config-optional)
|
/// * `author` ([`display_uname`], config-optional)
|
||||||
/// * `size / rdev` ([`display_len_or_rdev`])
|
/// * `size / rdev` ([`display_len_or_rdev`])
|
||||||
/// * `system_time` ([`get_system_time`])
|
/// * `system_time` ([`get_system_time`])
|
||||||
/// * `file_name` ([`display_file_name`])
|
/// * `item_name` ([`display_item_name`])
|
||||||
///
|
///
|
||||||
/// This function needs to display information in columns:
|
/// This function needs to display information in columns:
|
||||||
/// * permissions and system_time are already guaranteed to be pre-formatted in fixed length.
|
/// * permissions and system_time are already guaranteed to be pre-formatted in fixed length.
|
||||||
/// * file_name is the last column and is left-aligned.
|
/// * item_name is the last column and is left-aligned.
|
||||||
/// * Everything else needs to be padded using [`pad_left`].
|
/// * Everything else needs to be padded using [`pad_left`].
|
||||||
///
|
///
|
||||||
/// That's why we have the parameters:
|
/// That's why we have the parameters:
|
||||||
|
@ -2661,17 +2661,17 @@ fn display_item_long(
|
||||||
|
|
||||||
write!(output_display, " {} ", display_date(md, config)).unwrap();
|
write!(output_display, " {} ", display_date(md, config)).unwrap();
|
||||||
|
|
||||||
let displayed_file =
|
let displayed_item =
|
||||||
display_file_name(item, config, None, String::new(), out, style_manager).contents;
|
display_item_name(item, config, None, String::new(), out, style_manager).contents;
|
||||||
if config.dired {
|
if config.dired {
|
||||||
let (start, end) = dired::calculate_dired(
|
let (start, end) = dired::calculate_dired(
|
||||||
&dired.dired_positions,
|
&dired.dired_positions,
|
||||||
output_display.len(),
|
output_display.len(),
|
||||||
displayed_file.len(),
|
displayed_item.len(),
|
||||||
);
|
);
|
||||||
dired::update_positions(dired, start, end);
|
dired::update_positions(dired, start, end);
|
||||||
}
|
}
|
||||||
write!(output_display, "{}{}", displayed_file, config.line_ending).unwrap();
|
write!(output_display, "{}{}", displayed_item, config.line_ending).unwrap();
|
||||||
} else {
|
} else {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
let leading_char = {
|
let leading_char = {
|
||||||
|
@ -2744,8 +2744,8 @@ fn display_item_long(
|
||||||
write!(output_display, " {}", pad_right("?", padding.uname)).unwrap();
|
write!(output_display, " {}", pad_right("?", padding.uname)).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
let displayed_file =
|
let displayed_item =
|
||||||
display_file_name(item, config, None, String::new(), out, style_manager).contents;
|
display_item_name(item, config, None, String::new(), out, style_manager).contents;
|
||||||
let date_len = 12;
|
let date_len = 12;
|
||||||
|
|
||||||
write!(
|
write!(
|
||||||
|
@ -2760,10 +2760,10 @@ fn display_item_long(
|
||||||
dired::calculate_and_update_positions(
|
dired::calculate_and_update_positions(
|
||||||
dired,
|
dired,
|
||||||
output_display.len(),
|
output_display.len(),
|
||||||
displayed_file.trim().len(),
|
displayed_item.trim().len(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
write!(output_display, "{}{}", displayed_file, config.line_ending).unwrap();
|
write!(output_display, "{}{}", displayed_item, config.line_ending).unwrap();
|
||||||
}
|
}
|
||||||
write!(out, "{}", output_display)?;
|
write!(out, "{}", output_display)?;
|
||||||
|
|
||||||
|
@ -3033,11 +3033,12 @@ fn classify_file(path: &PathData, out: &mut BufWriter<Stdout>) -> Option<char> {
|
||||||
/// * `config.format` to display symlink targets if `Format::Long`. This function is also
|
/// * `config.format` to display symlink targets if `Format::Long`. This function is also
|
||||||
/// responsible for coloring symlink target names if `config.color` is specified.
|
/// responsible for coloring symlink target names if `config.color` is specified.
|
||||||
/// * `config.context` to prepend security context to `name` if compiled with `feat_selinux`.
|
/// * `config.context` to prepend security context to `name` if compiled with `feat_selinux`.
|
||||||
|
/// * `config.hyperlink` decides whether to hyperlink the item
|
||||||
///
|
///
|
||||||
/// Note that non-unicode sequences in symlink targets are dealt with using
|
/// Note that non-unicode sequences in symlink targets are dealt with using
|
||||||
/// [`std::path::Path::to_string_lossy`].
|
/// [`std::path::Path::to_string_lossy`].
|
||||||
#[allow(clippy::cognitive_complexity)]
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn display_file_name(
|
fn display_item_name(
|
||||||
path: &PathData,
|
path: &PathData,
|
||||||
config: &Config,
|
config: &Config,
|
||||||
prefix_context: Option<usize>,
|
prefix_context: Option<usize>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue