Skip to content

Commit

Permalink
Polish.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Nov 15, 2023
1 parent 895e7d0 commit 54ccbf9
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .prototools
Original file line number Diff line number Diff line change
@@ -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"
8 changes: 4 additions & 4 deletions crates/cli/src/app.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/commands/add_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
}
3 changes: 1 addition & 2 deletions crates/cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod plugins;
mod remove_plugin;
mod run;
mod setup;
mod tool;
pub mod tool;
mod tools;
mod unalias;
mod uninstall;
Expand All @@ -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::*;
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/commands/plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
}
2 changes: 1 addition & 1 deletion crates/cli/src/commands/remove_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
}
2 changes: 1 addition & 1 deletion crates/cli/src/commands/tool/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct AddToolArgs {
}

#[system]
pub async fn tool_add(args: ArgsRef<AddToolArgs>) {
pub async fn add(args: ArgsRef<AddToolArgs>) {
if args.global {
let mut user_config = UserConfig::load()?;
user_config
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/commands/tool/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct ToolInfoArgs {
}

#[system]
pub async fn tool_info(args: ArgsRef<ToolInfoArgs>) {
pub async fn info(args: ArgsRef<ToolInfoArgs>) {
let mut tool = load_tool(&args.id).await?;
let version = detect_version(&tool, None).await?;

Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/commands/tool/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct ListToolsArgs {
}

#[system]
pub async fn tool_list(args: ArgsRef<ListToolsArgs>) {
pub async fn list(args: ArgsRef<ListToolsArgs>) {
if !args.json {
info!("Loading tools...");
}
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/commands/tool/list_plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct ListToolPluginsArgs {
}

#[system]
pub async fn tool_list_plugins(args: ArgsRef<ListToolPluginsArgs>) {
pub async fn list_plugins(args: ArgsRef<ListToolPluginsArgs>) {
if !args.json {
info!("Loading plugins...");
}
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/commands/tool/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct RemoveToolArgs {
}

#[system]
pub async fn tool_remove(args: ArgsRef<RemoveToolArgs>) {
pub async fn remove(args: ArgsRef<RemoveToolArgs>) {
if args.global {
let mut user_config = UserConfig::load()?;
user_config.plugins.remove(&args.id);
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/commands/tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
}
14 changes: 7 additions & 7 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand Down

0 comments on commit 54ccbf9

Please sign in to comment.