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

@ -10,15 +10,15 @@ impl Plugin for Ps {
Ok(Signature::build("ps")
.desc("View information about system processes.")
.switch(
"full",
"long",
"list all available columns for each entry",
Some('f'),
Some('l'),
)
.filter())
}
fn begin_filter(&mut self, callinfo: CallInfo) -> Result<Vec<ReturnValue>, ShellError> {
Ok(block_on(ps(callinfo.name_tag, callinfo.args.has("full")))?
Ok(block_on(ps(callinfo.name_tag, callinfo.args.has("long")))?
.into_iter()
.map(ReturnSuccess::value)
.collect())

View File

@ -28,7 +28,7 @@ async fn usage(process: Process) -> ProcessResult<(process::Process, Ratio, proc
Ok((process, usage_2 - usage_1, memory))
}
pub async fn ps(tag: Tag, full: bool) -> Result<Vec<Value>, ShellError> {
pub async fn ps(tag: Tag, long: bool) -> Result<Vec<Value>, ShellError> {
let processes = process::processes()
.await
.map_err(|_| {
@ -67,7 +67,7 @@ pub async fn ps(tag: Tag, full: bool) -> Result<Vec<Value>, ShellError> {
"virtual",
UntaggedValue::filesize(memory.vms().get::<information::byte>()),
);
if full {
if long {
if let Ok(parent_pid) = process.parent_pid().await {
dict.insert_untagged("parent", UntaggedValue::int(parent_pid))
}