mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-12 13:28:49 +00:00
Rework "wasmer list"
This commit is contained in:
@@ -37,6 +37,11 @@ use wasmer_registry::{get_all_local_packages, PackageDownloadInfo};
|
|||||||
)]
|
)]
|
||||||
/// The options for the wasmer Command Line Interface
|
/// The options for the wasmer Command Line Interface
|
||||||
enum WasmerCLIOptions {
|
enum WasmerCLIOptions {
|
||||||
|
|
||||||
|
/// List all locally installed packages
|
||||||
|
#[clap(name = "list")]
|
||||||
|
List,
|
||||||
|
|
||||||
/// Run a WebAssembly file. Formats accepted: wasm, wat
|
/// Run a WebAssembly file. Formats accepted: wasm, wat
|
||||||
#[clap(name = "run")]
|
#[clap(name = "run")]
|
||||||
Run(Run),
|
Run(Run),
|
||||||
@@ -160,6 +165,7 @@ impl WasmerCLIOptions {
|
|||||||
Self::CreateObj(create_obj) => create_obj.execute(),
|
Self::CreateObj(create_obj) => create_obj.execute(),
|
||||||
Self::Config(config) => config.execute(),
|
Self::Config(config) => config.execute(),
|
||||||
Self::Inspect(inspect) => inspect.execute(),
|
Self::Inspect(inspect) => inspect.execute(),
|
||||||
|
Self::List => print_packages(),
|
||||||
#[cfg(feature = "wast")]
|
#[cfg(feature = "wast")]
|
||||||
Self::Wast(wast) => wast.execute(),
|
Self::Wast(wast) => wast.execute(),
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
@@ -207,9 +213,6 @@ fn wasmer_main_inner() -> Result<(), anyhow::Error> {
|
|||||||
(Some("-v"), _) | (Some("-V"), _) | (Some("version"), _) | (Some("--version"), _) => {
|
(Some("-v"), _) | (Some("-V"), _) | (Some("version"), _) | (Some("--version"), _) => {
|
||||||
return print_version(false);
|
return print_version(false);
|
||||||
}
|
}
|
||||||
(Some("list"), _) => {
|
|
||||||
return print_packages();
|
|
||||||
}
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,7 +222,7 @@ fn wasmer_main_inner() -> Result<(), anyhow::Error> {
|
|||||||
} else {
|
} else {
|
||||||
match command.unwrap_or(&"".to_string()).as_ref() {
|
match command.unwrap_or(&"".to_string()).as_ref() {
|
||||||
"cache" | "compile" | "config" | "create-exe" | "help" | "inspect" | "run"
|
"cache" | "compile" | "config" | "create-exe" | "help" | "inspect" | "run"
|
||||||
| "self-update" | "validate" | "wast" | "binfmt" => WasmerCLIOptions::parse(),
|
| "self-update" | "validate" | "wast" | "binfmt" | "list" => WasmerCLIOptions::parse(),
|
||||||
_ => {
|
_ => {
|
||||||
WasmerCLIOptions::try_parse_from(args.iter()).unwrap_or_else(|e| {
|
WasmerCLIOptions::try_parse_from(args.iter()).unwrap_or_else(|e| {
|
||||||
match e.kind() {
|
match e.kind() {
|
||||||
|
|||||||
Reference in New Issue
Block a user