diff --git a/Cargo.toml b/Cargo.toml index 3b29b1ed..cc067eb1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,6 +27,7 @@ uudoc = [] feat_common_core = [ "free", + "hugetop", "pgrep", "pidof", "pidwait", @@ -84,6 +85,7 @@ uucore = { workspace = true } # free = { optional = true, version = "0.0.1", package = "uu_free", path = "src/uu/free" } +hugetop = { optional = true, version = "0.0.1", package = "uu_hugetop", path = "src/uu/hugetop" } pgrep = { optional = true, version = "0.0.1", package = "uu_pgrep", path = "src/uu/pgrep" } pidof = { optional = true, version = "0.0.1", package = "uu_pidof", path = "src/uu/pidof" } pidwait = { optional = true, version = "0.0.1", package = "uu_pidwait", path = "src/uu/pidwait" } diff --git a/src/uu/hugetop/Cargo.toml b/src/uu/hugetop/Cargo.toml new file mode 100644 index 00000000..e0832864 --- /dev/null +++ b/src/uu/hugetop/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "uu_hugetop" +version = "0.0.1" +edition = "2021" +authors = ["uutils developers"] +license = "MIT" +description = "hugetop ~ (uutils) report huge page information" + +homepage = "https://github.com/uutils/procps" +repository = "https://github.com/uutils/procps/tree/main/src/uu/hugetop" +keywords = ["acl", "uutils", "cross-platform", "cli", "utility"] +categories = ["command-line-utilities"] + +[dependencies] +uucore = { workspace = true, features = ["utmpx", "uptime"] } +clap = { workspace = true } +libc = { workspace = true } +nix = { workspace = true } +prettytable-rs = { workspace = true } +sysinfo = { workspace = true } +chrono = { workspace = true } +bytesize = { workspace = true } + +# TODO: @hz2 finish adjusting +# for integration test of `--once`, mocking /proc etc. +[dev-dependencies] +assert_cmd = { workspace = true } +predicates = { workspace = true } + +[lib] +path = "src/hugetop.rs" + +[[bin]] +name = "hugetop" +path = "src/main.rs" diff --git a/src/uu/hugetop/hugetop.md b/src/uu/hugetop/hugetop.md new file mode 100644 index 00000000..43fafe17 --- /dev/null +++ b/src/uu/hugetop/hugetop.md @@ -0,0 +1,7 @@ +# hugetop + +``` +hugetop [options] +``` + +report huge page information diff --git a/src/uu/hugetop/src/hugetop.rs b/src/uu/hugetop/src/hugetop.rs new file mode 100644 index 00000000..b56a0984 --- /dev/null +++ b/src/uu/hugetop/src/hugetop.rs @@ -0,0 +1,28 @@ +// src/hugetop.rs + +use clap::{arg, crate_version, value_parser, ArgAction, Command}; +use std::{ + fs, + io::{BufRead, BufReader}, + thread::sleep, + time::Duration, +}; +use uucore::{error::UResult, format_usage, help_about, help_usage}; + +use bytesize::ByteSize; +use chrono::Local; + +const ABOUT: &str = help_about!("hugetop.md"); +const USAGE: &str = help_usage!("hugetop.md"); + +pub struct Settings { + delay: Option, + human: bool, + once: bool, + numa: bool, +} + +#[uucore::main] +pub fn uumain(args: impl uucore::Args) -> UResult<()> { + todo!(); +} diff --git a/src/uu/hugetop/src/main.rs b/src/uu/hugetop/src/main.rs new file mode 100644 index 00000000..1e6f1470 --- /dev/null +++ b/src/uu/hugetop/src/main.rs @@ -0,0 +1 @@ +uucore::bin!(uu_hugetop);