diff --git a/Cargo.lock b/Cargo.lock index 6102ba1..6eced03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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" diff --git a/Cargo.toml b/Cargo.toml index 95d2a31..dc1c989 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" } diff --git a/src/uu/lsmem/Cargo.toml b/src/uu/lsmem/Cargo.toml new file mode 100644 index 0000000..a76660a --- /dev/null +++ b/src/uu/lsmem/Cargo.toml @@ -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 } diff --git a/src/uu/lsmem/lsmem.md b/src/uu/lsmem/lsmem.md new file mode 100644 index 0000000..7903bbd --- /dev/null +++ b/src/uu/lsmem/lsmem.md @@ -0,0 +1,7 @@ +# lsmem + +``` +lsmem [OPTION]... +``` + +List the ranges of available memory with their online status. diff --git a/src/uu/lsmem/src/lsmem.rs b/src/uu/lsmem/src/lsmem.rs new file mode 100644 index 0000000..d8f3388 --- /dev/null +++ b/src/uu/lsmem/src/lsmem.rs @@ -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) +} diff --git a/src/uu/lsmem/src/main.rs b/src/uu/lsmem/src/main.rs new file mode 100644 index 0000000..33561cd --- /dev/null +++ b/src/uu/lsmem/src/main.rs @@ -0,0 +1 @@ +uucore::bin!(uu_lsmem); diff --git a/tests/by-util/test_lsmem.rs b/tests/by-util/test_lsmem.rs new file mode 100644 index 0000000..33c603c --- /dev/null +++ b/tests/by-util/test_lsmem.rs @@ -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.