lsmem: Add lsmem

This commit is contained in:
Yang Hau
2024-07-26 00:18:09 +08:00
parent a53e1ea45e
commit 5091640b74
7 changed files with 62 additions and 0 deletions

9
Cargo.lock generated

@ -643,6 +643,7 @@ dependencies = [
"textwrap",
"uu_ctrlaltdel",
"uu_lscpu",
"uu_lsmem",
"uu_mountpoint",
"uu_rev",
"uucore",
@ -667,6 +668,14 @@ dependencies = [
"uucore",
]
[[package]]
name = "uu_lsmem"
version = "0.0.1"
dependencies = [
"clap",
"uucore",
]
[[package]]
name = "uu_mountpoint"
version = "0.0.1"

@ -27,6 +27,7 @@ default = ["feat_common_core"]
feat_common_core = [
"mountpoint",
"lscpu",
"lsmem",
"ctrlaltdel",
"rev",
]
@ -57,6 +58,7 @@ textwrap = { workspace = true }
#
lscpu = { optional = true, version = "0.0.1", package = "uu_lscpu", path = "src/uu/lscpu" }
lsmem = { optional = true, version = "0.0.1", package = "uu_lsmem", path = "src/uu/lsmem" }
mountpoint = { optional = true, version = "0.0.1", package = "uu_mountpoint", path = "src/uu/mountpoint" }
ctrlaltdel = { optional = true, version = "0.0.1", package = "uu_ctrlaltdel", path = "src/uu/ctrlaltdel" }
rev = { optional = true, version = "0.0.1", package = "uu_rev", path = "src/uu/rev" }

15
src/uu/lsmem/Cargo.toml Normal file

@ -0,0 +1,15 @@
[package]
name = "uu_lsmem"
version = "0.0.1"
edition = "2021"
[lib]
path = "src/lsmem.rs"
[[bin]]
name = "lsmem"
path = "src/main.rs"
[dependencies]
uucore = { workspace = true }
clap = { workspace = true }

7
src/uu/lsmem/lsmem.md Normal file

@ -0,0 +1,7 @@
# lsmem
```
lsmem [OPTION]...
```
List the ranges of available memory with their online status.

24
src/uu/lsmem/src/lsmem.rs Normal file

@ -0,0 +1,24 @@
// This file is part of the uutils util-linux package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
use clap::{crate_version, Command};
use uucore::{error::UResult, format_usage, help_about, help_usage};
const ABOUT: &str = help_about!("lsmem.md");
const USAGE: &str = help_usage!("lsmem.md");
#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let _matches: clap::ArgMatches = uu_app().try_get_matches_from(args)?;
Ok(())
}
pub fn uu_app() -> Command {
Command::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.override_usage(format_usage(USAGE))
.infer_long_args(true)
}

1
src/uu/lsmem/src/main.rs Normal file

@ -0,0 +1 @@
uucore::bin!(uu_lsmem);

@ -0,0 +1,4 @@
// This file is part of the uutils util-linux package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.