Change f/full flag to l/long for ls and ps commands (#2283)

* Change `f`/`full` flag to `l`/`long` for `ls` and `ps` commands

* Fix a few more `--full` instances
This commit is contained in:
Joseph T. Lyons
2020-08-01 14:30:45 -04:00
committed by GitHub
parent 4ef15b5f80
commit 9fb6f5cd09
13 changed files with 34 additions and 33 deletions

View File

@ -49,7 +49,7 @@ impl WholeStreamCommand for Compact {
},
Example {
description: "Filter out all directory entries having no 'target'",
example: "ls -af | compact target",
example: "ls -la | compact target",
result: None,
},
]

View File

@ -45,7 +45,7 @@ impl WholeStreamCommand for Default {
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "Give a default 'target' to all file entries",
example: "ls -af | default target 'nothing'",
example: "ls -la | default target 'nothing'",
result: None,
}]
}

View File

@ -11,7 +11,7 @@ pub struct Ls;
pub struct LsArgs {
pub path: Option<Tagged<PathBuf>>,
pub all: bool,
pub full: bool,
pub long: bool,
#[serde(rename = "short-names")]
pub short_names: bool,
#[serde(rename = "with-symlink-targets")]
@ -33,25 +33,26 @@ impl WholeStreamCommand for Ls {
SyntaxShape::Pattern,
"a path to get the directory contents from",
)
.switch("all", "also show hidden files", Some('a'))
.switch("all", "Show hidden files", Some('a'))
.switch(
"full",
"list all available columns for each entry",
Some('f'),
"long",
"List all available columns for each entry",
Some('l'),
)
.switch(
"short-names",
"only print the file names and not the path",
"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",
"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",
"Display the apparent directory size in place of the directory metadata size",
Some('d'),
)
}

View File

@ -37,7 +37,7 @@ pub(crate) fn dir_entry_dict(
filename: &std::path::Path,
metadata: Option<&std::fs::Metadata>,
tag: impl Into<Tag>,
full: bool,
long: bool,
short_name: bool,
with_symlink_targets: bool,
du: bool,
@ -46,7 +46,7 @@ pub(crate) fn dir_entry_dict(
let tag = tag.into();
let mut dict = TaggedDictBuilder::new(&tag);
// Insert all columns first to maintain proper table alignment if we can't find (or are not allowed to view) any information
if full {
if long {
#[cfg(windows)]
{
for column in [
@ -97,7 +97,7 @@ pub(crate) fn dir_entry_dict(
dict.insert_untagged("type", get_file_type(md));
}
if full || with_symlink_targets {
if long || with_symlink_targets {
if let Some(md) = metadata {
if md.file_type().is_symlink() {
let symlink_target_untagged_value: UntaggedValue;
@ -113,7 +113,7 @@ pub(crate) fn dir_entry_dict(
}
}
if full {
if long {
if let Some(md) = metadata {
dict.insert_untagged(
"readonly",
@ -181,7 +181,7 @@ pub(crate) fn dir_entry_dict(
}
if let Some(md) = metadata {
if full {
if long {
if let Ok(c) = md.created() {
dict.insert_untagged("created", UntaggedValue::system_date(c));
}

View File

@ -95,7 +95,7 @@ impl Shell for FilesystemShell {
LsArgs {
path,
all,
full,
long,
short_names,
with_symlink_targets,
du,
@ -164,7 +164,7 @@ impl Shell for FilesystemShell {
&path,
metadata.as_ref(),
name_tag.clone(),
full,
long,
short_names,
with_symlink_targets,
du,

View File

@ -180,10 +180,10 @@ fn list_all_columns() {
);
let expected = ["name", "type", "target", "size", "modified"].join("");
assert_eq!(actual.out, expected, "column names are incorrect for ls -w");
// Full
// Long
let actual = nu!(
cwd: dirs.test(),
"ls -f | get | to md"
"ls -l | get | to md"
);
let expected = {
#[cfg(unix)]
@ -206,7 +206,7 @@ fn list_all_columns() {
};
assert_eq!(
actual.out, expected,
"column names are incorrect for ls full"
"column names are incorrect for ls long"
);
},
);