Skip to content

Commit

Permalink
slabtop: Add command
Browse files Browse the repository at this point in the history
  • Loading branch information
Krysztal112233 authored and sylvestre committed Apr 2, 2024
1 parent 94c8f17 commit 0944f2f
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 7 deletions.
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@ build = "build.rs"
default = ["feat_common_core"]
uudoc = []

feat_common_core = [
"pwdx",
"free",
"w",
"watch",
"pmap",
]
feat_common_core = ["pwdx", "free", "w", "watch", "pmap"]

[workspace.dependencies]
uucore = "0.0.25"
Expand Down Expand Up @@ -68,6 +62,7 @@ free = { optional = true, version = "0.0.1", package = "uu_free", path = "src/uu
w = { optional = true, version = "0.0.1", package = "uu_w", path = "src/uu/w" }
watch = { optional = true, version = "0.0.1", package = "uu_watch", path = "src/uu/watch" }
pmap = { optional = true, version = "0.0.1", package = "uu_pmap", path = "src/uu/pmap" }
slabtop = { optional = true, version = "0.0.1", package = "uu_slabtop", path = "src/uu/slabtop" }

[dev-dependencies]
pretty_assertions = "1"
Expand Down
27 changes: 27 additions & 0 deletions src/uu/slabtop/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[package]
name = "uu_slabtop"
version = "0.0.1"
edition = "2021"
authors = ["uutils developers"]
license = "MIT"
description = "slabtop ~ (uutils) Display kernel slab cache information in real time"

homepage = "https://github.com/uutils/procps"
repository = "https://github.com/uutils/procps/tree/main/src/uu/slabtop"
keywords = ["acl", "uutils", "cross-platform", "cli", "utility"]
categories = ["command-line-utilities"]


[dependencies]
uucore = { workspace = true }
clap = { workspace = true }
bytesize = { workspace = true }

sysinfo = { workspace = true }

[lib]
path = "src/slabtop.rs"

[[bin]]
name = "slabtop"
path = "src/main.rs"
7 changes: 7 additions & 0 deletions src/uu/slabtop/slabtop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# slabtop

```
slabtop [options]
```

Display kernel slab cache information in real time
1 change: 1 addition & 0 deletions src/uu/slabtop/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uucore::bin!(uu_slabtop);
32 changes: 32 additions & 0 deletions src/uu/slabtop/src/slabtop.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// This file is part of the uutils procps package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.

use clap::{arg, crate_version, ArgAction, Command};
use uucore::{error::UResult, format_usage, help_about, help_usage};

const ABOUT: &str = help_about!("slabtop.md");
const USAGE: &str = help_usage!("slabtop.md");

#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let _matches = 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)
.disable_help_flag(true)
.args([
arg!(-d --delay <secs> "delay updates"),
arg!(-o --once "only display once, then exit"),
arg!(-s --sort <char> "specify sort criteria by character (see below)"),
arg!(-h --help "display this help and exit").action(ArgAction::Help),
])
}

0 comments on commit 0944f2f

Please sign in to comment.