diff --git a/.prototools b/.prototools index 4ae40a5ef..923096da7 100644 --- a/.prototools +++ b/.prototools @@ -1,3 +1,3 @@ [plugins] moon-test = "source:https://raw.githubusercontent.com/moonrepo/moon/master/proto-plugin.toml" -# wasm-test = "source:./plugins/target/wasm32-wasi/debug/proto_wasm_test.wasm" +wasm-test = "source:./plugins/target/wasm32-wasi/debug/proto_wasm_test.wasm" diff --git a/crates/cli/src/app.rs b/crates/cli/src/app.rs index 4d6ab257a..8cf9b68c1 100644 --- a/crates/cli/src/app.rs +++ b/crates/cli/src/app.rs @@ -1,8 +1,8 @@ use crate::commands::{ - AddToolArgs, AliasArgs, BinArgs, CleanArgs, CompletionsArgs, InstallArgs, InstallGlobalArgs, - ListArgs, ListGlobalArgs, ListRemoteArgs, ListToolPluginsArgs, ListToolsArgs, MigrateArgs, - OutdatedArgs, PinArgs, RemoveToolArgs, RunArgs, SetupArgs, ToolInfoArgs, UnaliasArgs, - UninstallArgs, UninstallGlobalArgs, + tool::{AddToolArgs, ListToolPluginsArgs, ListToolsArgs, RemoveToolArgs, ToolInfoArgs}, + AliasArgs, BinArgs, CleanArgs, CompletionsArgs, InstallArgs, InstallGlobalArgs, ListArgs, + ListGlobalArgs, ListRemoteArgs, MigrateArgs, OutdatedArgs, PinArgs, RunArgs, SetupArgs, + UnaliasArgs, UninstallArgs, UninstallGlobalArgs, }; use clap::builder::styling::{Color, Style, Styles}; use clap::{Parser, Subcommand, ValueEnum}; diff --git a/crates/cli/src/commands/add_plugin.rs b/crates/cli/src/commands/add_plugin.rs index 8cfee75fa..56b9eb673 100644 --- a/crates/cli/src/commands/add_plugin.rs +++ b/crates/cli/src/commands/add_plugin.rs @@ -10,5 +10,5 @@ pub async fn add_plugin_old() { color::shell("proto tool add") ); - tool::tool_add(states, resources, emitters).await?; + tool::add(states, resources, emitters).await?; } diff --git a/crates/cli/src/commands/mod.rs b/crates/cli/src/commands/mod.rs index 2bd8ac353..a24179182 100644 --- a/crates/cli/src/commands/mod.rs +++ b/crates/cli/src/commands/mod.rs @@ -16,7 +16,7 @@ mod plugins; mod remove_plugin; mod run; mod setup; -mod tool; +pub mod tool; mod tools; mod unalias; mod uninstall; @@ -41,7 +41,6 @@ pub use plugins::*; pub use remove_plugin::*; pub use run::*; pub use setup::*; -pub use tool::*; pub use tools::*; pub use unalias::*; pub use uninstall::*; diff --git a/crates/cli/src/commands/plugins.rs b/crates/cli/src/commands/plugins.rs index 39ec7d3c8..53192d866 100644 --- a/crates/cli/src/commands/plugins.rs +++ b/crates/cli/src/commands/plugins.rs @@ -10,5 +10,5 @@ pub async fn plugins() { color::shell("proto tool list-plugins") ); - tool::tool_list_plugins(states, resources, emitters).await?; + tool::list_plugins(states, resources, emitters).await?; } diff --git a/crates/cli/src/commands/remove_plugin.rs b/crates/cli/src/commands/remove_plugin.rs index 2d5b0f349..4423e18d4 100644 --- a/crates/cli/src/commands/remove_plugin.rs +++ b/crates/cli/src/commands/remove_plugin.rs @@ -10,5 +10,5 @@ pub async fn remove_plugin_old() { color::shell("proto tool remove") ); - tool::tool_remove(states, resources, emitters).await?; + tool::remove(states, resources, emitters).await?; } diff --git a/crates/cli/src/commands/tool/add.rs b/crates/cli/src/commands/tool/add.rs index b38c0cad7..7fc6540da 100644 --- a/crates/cli/src/commands/tool/add.rs +++ b/crates/cli/src/commands/tool/add.rs @@ -20,7 +20,7 @@ pub struct AddToolArgs { } #[system] -pub async fn tool_add(args: ArgsRef) { +pub async fn add(args: ArgsRef) { if args.global { let mut user_config = UserConfig::load()?; user_config diff --git a/crates/cli/src/commands/tool/info.rs b/crates/cli/src/commands/tool/info.rs index d78a4d7a0..cfd5dfa26 100644 --- a/crates/cli/src/commands/tool/info.rs +++ b/crates/cli/src/commands/tool/info.rs @@ -33,7 +33,7 @@ pub struct ToolInfoArgs { } #[system] -pub async fn tool_info(args: ArgsRef) { +pub async fn info(args: ArgsRef) { let mut tool = load_tool(&args.id).await?; let version = detect_version(&tool, None).await?; diff --git a/crates/cli/src/commands/tool/list.rs b/crates/cli/src/commands/tool/list.rs index 026d2a6d3..c6dfbaa95 100644 --- a/crates/cli/src/commands/tool/list.rs +++ b/crates/cli/src/commands/tool/list.rs @@ -21,7 +21,7 @@ pub struct ListToolsArgs { } #[system] -pub async fn tool_list(args: ArgsRef) { +pub async fn list(args: ArgsRef) { if !args.json { info!("Loading tools..."); } diff --git a/crates/cli/src/commands/tool/list_plugins.rs b/crates/cli/src/commands/tool/list_plugins.rs index fff5aaf2d..635a62912 100644 --- a/crates/cli/src/commands/tool/list_plugins.rs +++ b/crates/cli/src/commands/tool/list_plugins.rs @@ -23,7 +23,7 @@ pub struct ListToolPluginsArgs { } #[system] -pub async fn tool_list_plugins(args: ArgsRef) { +pub async fn list_plugins(args: ArgsRef) { if !args.json { info!("Loading plugins..."); } diff --git a/crates/cli/src/commands/tool/remove.rs b/crates/cli/src/commands/tool/remove.rs index 2244407f9..72fd376c4 100644 --- a/crates/cli/src/commands/tool/remove.rs +++ b/crates/cli/src/commands/tool/remove.rs @@ -20,7 +20,7 @@ pub struct RemoveToolArgs { } #[system] -pub async fn tool_remove(args: ArgsRef) { +pub async fn remove(args: ArgsRef) { if args.global { let mut user_config = UserConfig::load()?; user_config.plugins.remove(&args.id); diff --git a/crates/cli/src/commands/tools.rs b/crates/cli/src/commands/tools.rs index e08897bce..a4943aaf3 100644 --- a/crates/cli/src/commands/tools.rs +++ b/crates/cli/src/commands/tools.rs @@ -10,5 +10,5 @@ pub async fn tools() { color::shell("proto tool list") ); - tool::tool_list(states, resources, emitters).await?; + tool::list(states, resources, emitters).await?; } diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 8eb92f7ea..47782bb77 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -2,8 +2,8 @@ mod app; mod commands; mod error; mod helpers; -mod shell; mod printer; +mod shell; use app::{App as CLI, Commands, ToolCommands}; use clap::Parser; @@ -56,7 +56,7 @@ async fn main() -> MainResult { Commands::Completions(args) => app.execute_with_args(commands::completions, args), Commands::Install(args) => app.execute_with_args(commands::install, args), Commands::InstallGlobal(args) => app.execute_with_args(commands::install_global, args), - Commands::List(args) => app.execute_with_args(commands::list, args), + Commands::List(args) => app.execute_with_args(commands::tool::list, args), Commands::ListGlobal(args) => app.execute_with_args(commands::list_global, args), Commands::ListRemote(args) => app.execute_with_args(commands::list_remote, args), Commands::Migrate(args) => app.execute_with_args(commands::migrate, args), @@ -67,13 +67,13 @@ async fn main() -> MainResult { Commands::Run(args) => app.execute_with_args(commands::run, args), Commands::Setup(args) => app.execute_with_args(commands::setup, args), Commands::Tool { command } => match command { - ToolCommands::Add(args) => app.execute_with_args(commands::tool_add, args), - ToolCommands::Info(args) => app.execute_with_args(commands::tool_info, args), - ToolCommands::List(args) => app.execute_with_args(commands::tool_list, args), + ToolCommands::Add(args) => app.execute_with_args(commands::tool::add, args), + ToolCommands::Info(args) => app.execute_with_args(commands::tool::info, args), + ToolCommands::List(args) => app.execute_with_args(commands::tool::list, args), ToolCommands::ListPlugins(args) => { - app.execute_with_args(commands::tool_list_plugins, args) + app.execute_with_args(commands::tool::list_plugins, args) } - ToolCommands::Remove(args) => app.execute_with_args(commands::tool_remove, args), + ToolCommands::Remove(args) => app.execute_with_args(commands::tool::remove, args), }, Commands::Tools(args) => app.execute_with_args(commands::tools, args), Commands::Unalias(args) => app.execute_with_args(commands::unalias, args),