mirror of
https://github.com/orhun/kmon
synced 2024-07-08 20:06:03 +00:00
feat: Reword sorting argument --used to --dependent and updating descriptions accordingly
This commit is contained in:
parent
2162514006
commit
5dfc245046
10
README.md
10
README.md
|
@ -215,9 +215,9 @@ sort Sort kernel modules
|
|||
kmon sort [FLAGS]
|
||||
|
||||
FLAGS:
|
||||
-n, --name Sort modules by their names
|
||||
-s, --size Sort modules by their sizes
|
||||
-u, --used Sort modules by used-by other modules
|
||||
-n, --name Sort modules by their names
|
||||
-s, --size Sort modules by their sizes
|
||||
-d, --dependent Sort modules by their dependent modules
|
||||
```
|
||||
|
||||
## Key Bindings
|
||||
|
@ -352,12 +352,12 @@ Use `ctrl-c/ctrl-v` for copying and pasting while in input mode.
|
|||
|
||||
### Sorting/reversing the kernel modules
|
||||
|
||||
`sort` subcommand can be used for sorting the kernel modules by their names, sizes or used-by.
|
||||
`sort` subcommand can be used for sorting the kernel modules by their names, sizes or dependent modules.
|
||||
|
||||
```
|
||||
kmon sort --name
|
||||
kmon sort --size
|
||||
kmon sort --used
|
||||
kmon sort --dependent
|
||||
```
|
||||
|
||||
Also the `-r, --reverse` flag is used for reversing the kernel module list.
|
||||
|
|
|
@ -11,7 +11,7 @@ enum SortType {
|
|||
None,
|
||||
Size,
|
||||
Name,
|
||||
Used,
|
||||
Dependent,
|
||||
}
|
||||
|
||||
/* Listing properties of module list */
|
||||
|
@ -32,8 +32,8 @@ impl ListArgs {
|
|||
if let Some(matches) = args.subcommand_matches("sort") {
|
||||
if matches.is_present("size") {
|
||||
sort_type = SortType::Size;
|
||||
} else if matches.is_present("used") {
|
||||
sort_type = SortType::Used;
|
||||
} else if matches.is_present("dependent") {
|
||||
sort_type = SortType::Dependent;
|
||||
} else {
|
||||
sort_type = SortType::Name;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ impl KernelModules<'_> {
|
|||
match self.args.sort {
|
||||
SortType::Size => module_read_cmd += " | sort -n -r -t ' ' -k2",
|
||||
SortType::Name => module_read_cmd += " | sort -t ' ' -k1",
|
||||
SortType::Used => module_read_cmd += " | sort -n -r -t ' ' -k3",
|
||||
SortType::Dependent => module_read_cmd += " | sort -n -r -t ' ' -k3",
|
||||
_ => {}
|
||||
}
|
||||
let modules_content = util::exec_cmd("sh", &["-c", &module_read_cmd])
|
||||
|
|
|
@ -104,10 +104,10 @@ pub fn parse_args() -> clap::ArgMatches<'static> {
|
|||
.help("Sort modules by their names"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("used")
|
||||
.short("u")
|
||||
.long("used")
|
||||
.help("Sort modules by used-by other modules"),
|
||||
Arg::with_name("dependent")
|
||||
.short("d")
|
||||
.long("dependent")
|
||||
.help("Sort modules by their dependent modules"),
|
||||
),
|
||||
)
|
||||
.get_matches()
|
||||
|
|
Loading…
Reference in New Issue
Block a user