Skip to content

Commit 182d494

Browse files
committed
Add wide option when listing plugins
1 parent 40e6d39 commit 182d494

9 files changed

Lines changed: 1018 additions & 613 deletions

File tree

Cargo.lock

Lines changed: 931 additions & 437 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,46 @@ documentation = "https://docs.rs/memflowup"
88
readme = "README.md"
99
homepage = "https://memflow.github.io"
1010
repository = "https://github.com/memflow/memflowup"
11-
license-file = "LICENSE"
12-
keywords = [ "memflow", "introspection", "memflowup", "memory", "dma" ]
11+
license = "MIT"
12+
keywords = [ "memflow", "introspection", "memory", "dma" ]
1313
categories = [ "memory-management", "os" ]
14+
rust-version = "1.74.0"
1415

1516
[dependencies]
1617
# general dependencies
1718
log = "0.4"
1819
env_logger = "0.11"
19-
thiserror = "1.0"
20+
thiserror = "2.0"
2021
clap = { version = "4.5", features = ["cargo"] }
2122
console = "0.15"
2223
inquire = "0.7"
2324

2425
# async runtime
25-
tokio = { version = "1.40.0", features = ["macros", "rt-multi-thread", "fs", "signal"] }
26-
bytes = "1.7"
26+
tokio = { version = "1.45", features = ["macros", "rt-multi-thread", "fs", "signal"] }
27+
bytes = "1.10"
2728

2829
# serializing
2930
serde = { version = "1.0", features = ["derive"] }
3031
serde_json = "1.0"
3132

3233
# memflowup dirs
33-
dirs = "5.0"
34+
dirs = "6.0"
3435

3536
# ensure_rust checks
36-
which = "6.0"
37+
which = "7.0"
3738

3839
# update check
39-
crates_io_api = { version = "0.11.0", default-features = false, features = ["rustls"] }
40+
crates_io_api = { version = "0.11", default-features = false, features = ["rustls"] }
4041

4142
# memflow-registry
4243
memflow = ">=0.2.3"
44+
#memflow-registry = { path = "../memflow-registry" }
4345
memflow-registry = "0.1"
44-
sha256 = "1.5"
46+
sha256 = "1.6"
4547

4648
# source builds
4749
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "json", "stream"] }
48-
zip = "2.2"
50+
zip = "2.6"
4951
chrono = { version = "0.4", features = ["serde"] }
5052

5153
# download progress

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
MIT License
22

3-
Copyright (c) 2022 ko1N <ko1N1337@gmail.com>
4-
Copyright (c) 2022 Aurimas Blažulionis <0x60@pm.me>
3+
Copyright (c) 2022-2025 ko1N <ko1N1337@gmail.com>
4+
Copyright (c) 2022-2025 Aurimas Blažulionis <0x60@pm.me>
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal

index.json

Lines changed: 0 additions & 79 deletions
This file was deleted.

src/commands/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,3 @@ pub mod plugins;
44
pub mod pull;
55
pub mod push;
66
pub mod registry;
7-
8-
#[allow(clippy::print_literal)]
9-
#[inline]
10-
fn print_plugin_versions_header() {
11-
println!(
12-
"{0: <16} {1: <16} {2: <12} {3: <4} {4: <8} {5: <65} {6:}",
13-
"NAME", "VERSION", "ARCH", "ABI", "DIGEST", "DIGEST_LONG", "CREATED"
14-
);
15-
}

src/commands/plugins.rs

Lines changed: 62 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,15 @@ pub fn metadata() -> Command {
1515
Command::new("plugins")
1616
.subcommand_required(true)
1717
.subcommands([
18-
Command::new("list")
19-
.alias("ls")
20-
.args([Arg::new("plugin_name")
18+
Command::new("list").alias("ls").args([
19+
Arg::new("plugin_name")
2120
.help("name of the plugin as an additional filter")
22-
.action(ArgAction::Set)]),
21+
.action(ArgAction::Set),
22+
Arg::new("wide")
23+
.help("show a wide table")
24+
.long("wide")
25+
.action(ArgAction::SetTrue),
26+
]),
2327
Command::new("clean").alias("purge"),
2428
Command::new("remove")
2529
.alias("rm")
@@ -32,8 +36,13 @@ pub fn metadata() -> Command {
3236
pub async fn handle(matches: &ArgMatches) -> Result<()> {
3337
match matches.subcommand() {
3438
Some(("list", matches)) => {
35-
super::print_plugin_versions_header();
36-
list_local_plugins(matches.get_one::<String>("plugin_name").map(String::as_str)).await
39+
let wide = matches.get_flag("wide");
40+
print_local_plugin_header(wide);
41+
list_local_plugins(
42+
matches.get_one::<String>("plugin_name").map(String::as_str),
43+
wide,
44+
)
45+
.await
3746
}
3847
Some(("remove", matches)) => {
3948
let plugin_uris = matches
@@ -62,7 +71,23 @@ pub async fn handle(matches: &ArgMatches) -> Result<()> {
6271
}
6372
}
6473

65-
async fn list_local_plugins(plugin_name: Option<&str>) -> Result<()> {
74+
#[allow(clippy::print_literal)]
75+
#[inline]
76+
fn print_local_plugin_header(wide: bool) {
77+
if !wide {
78+
println!(
79+
"{0: <16} {1: <16} {2: <12} {3: <4} {4: <8}",
80+
"NAME", "VERSION", "ARCH", "ABI", "DIGEST"
81+
);
82+
} else {
83+
println!(
84+
"{0: <16} {1: <16} {2: <12} {3: <4} {4: <8} {5: <65} {6:} {7: <64?}",
85+
"NAME", "VERSION", "ARCH", "ABI", "DIGEST", "DIGEST_LONG", "CREATED", "PATH"
86+
);
87+
}
88+
}
89+
90+
async fn list_local_plugins(plugin_name: Option<&str>, wide: bool) -> Result<()> {
6691
let plugins = util::local_plugins().await?;
6792
for plugin in plugins.into_iter() {
6893
// optionally filter by plugin name
@@ -72,20 +97,36 @@ async fn list_local_plugins(plugin_name: Option<&str>) -> Result<()> {
7297
}
7398
}
7499

75-
println!(
76-
"{0: <16} {1: <16} {2: <12} {3: <4} {4: <8} {5: <65} {6:}",
77-
plugin.descriptor.name,
78-
plugin.descriptor.version,
79-
format!(
80-
"{:?}/{:?}",
81-
plugin.descriptor.file_type, plugin.descriptor.architecture
82-
)
83-
.to_ascii_lowercase(),
84-
plugin.descriptor.plugin_version,
85-
&plugin.digest[..7],
86-
plugin.digest,
87-
plugin.created_at,
88-
);
100+
if !wide {
101+
println!(
102+
"{0: <16} {1: <16} {2: <12} {3: <4} {4: <8}",
103+
plugin.descriptor.name,
104+
plugin.descriptor.version,
105+
format!(
106+
"{:?}/{:?}",
107+
plugin.descriptor.file_type, plugin.descriptor.architecture
108+
)
109+
.to_ascii_lowercase(),
110+
plugin.descriptor.plugin_version,
111+
&plugin.digest[..7],
112+
);
113+
} else {
114+
println!(
115+
"{0: <16} {1: <16} {2: <12} {3: <4} {4: <8} {5: <65} {6:} {7: <64?}",
116+
plugin.descriptor.name,
117+
plugin.descriptor.version,
118+
format!(
119+
"{:?}/{:?}",
120+
plugin.descriptor.file_type, plugin.descriptor.architecture
121+
)
122+
.to_ascii_lowercase(),
123+
plugin.descriptor.plugin_version,
124+
&plugin.digest[..7],
125+
plugin.digest,
126+
plugin.created_at,
127+
plugin.plugin_file_name,
128+
);
129+
}
89130
}
90131
Ok(())
91132
}

src/commands/registry.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub async fn handle(matches: &ArgMatches) -> Result<()> {
6767

6868
if let Some(plugin_name) = matches.get_one::<String>("plugin_name") {
6969
let limit = matches.get_one::<usize>("limit").unwrap();
70-
super::print_plugin_versions_header();
70+
print_plugin_versions_header();
7171
list_plugin_versions(registry, plugin_name, all_archs, *limit).await?;
7272
} else {
7373
let versions = matches.get_flag("versions");
@@ -76,7 +76,7 @@ pub async fn handle(matches: &ArgMatches) -> Result<()> {
7676
let plugins = memflow_registry::client::plugins(registry).await?;
7777
if versions {
7878
// TODO: display plugins that do not have a version for our current os?
79-
super::print_plugin_versions_header();
79+
print_plugin_versions_header();
8080
for plugin in plugins.iter() {
8181
list_plugin_versions(registry, &plugin.name, all_archs, 1).await?;
8282
}
@@ -114,6 +114,15 @@ pub async fn handle(matches: &ArgMatches) -> Result<()> {
114114
}
115115
}
116116

117+
#[allow(clippy::print_literal)]
118+
#[inline]
119+
fn print_plugin_versions_header() {
120+
println!(
121+
"{0: <16} {1: <16} {2: <12} {3: <4} {4: <8} {5: <65} {6:}",
122+
"NAME", "VERSION", "ARCH", "ABI", "DIGEST", "DIGEST_LONG", "CREATED"
123+
);
124+
}
125+
117126
async fn list_plugin_versions(
118127
registry: Option<&str>,
119128
plugin_name: &str,

standard.rhai

Lines changed: 0 additions & 27 deletions
This file was deleted.

target_rename.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)