mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-01 23:13:16 +02:00
Move build/dev/generate/publish under plugin command
This commit is contained in:
@@ -26,17 +26,8 @@ pub enum Commands {
|
||||
/// Authentication commands
|
||||
Auth(AuthArgs),
|
||||
|
||||
/// Transpile code into a runnable plugin bundle
|
||||
Build(PluginPathArg),
|
||||
|
||||
/// Build plugin bundle continuously when the filesystem changes
|
||||
Dev(PluginPathArg),
|
||||
|
||||
/// Generate a "Hello World" Yaak plugin
|
||||
Generate(GenerateArgs),
|
||||
|
||||
/// Publish a Yaak plugin version to the plugin registry
|
||||
Publish(PluginPathArg),
|
||||
/// Plugin development and publishing commands
|
||||
Plugin(PluginArgs),
|
||||
|
||||
/// Send a request, folder, or workspace by ID
|
||||
Send(SendArgs),
|
||||
@@ -339,6 +330,27 @@ pub enum AuthCommands {
|
||||
Whoami,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct PluginArgs {
|
||||
#[command(subcommand)]
|
||||
pub command: PluginCommands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum PluginCommands {
|
||||
/// Transpile code into a runnable plugin bundle
|
||||
Build(PluginPathArg),
|
||||
|
||||
/// Build plugin bundle continuously when the filesystem changes
|
||||
Dev(PluginPathArg),
|
||||
|
||||
/// Generate a "Hello World" Yaak plugin
|
||||
Generate(GenerateArgs),
|
||||
|
||||
/// Publish a Yaak plugin version to the plugin registry
|
||||
Publish(PluginPathArg),
|
||||
}
|
||||
|
||||
#[derive(Args, Clone)]
|
||||
pub struct PluginPathArg {
|
||||
/// Path to plugin directory (defaults to current working directory)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::cli::{GenerateArgs, PluginPathArg};
|
||||
use crate::cli::{GenerateArgs, PluginArgs, PluginCommands, PluginPathArg};
|
||||
use crate::ui;
|
||||
use keyring::Entry;
|
||||
use rand::Rng;
|
||||
@@ -57,6 +57,15 @@ pub async fn run_build(args: PluginPathArg) -> i32 {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn run(args: PluginArgs) -> i32 {
|
||||
match args.command {
|
||||
PluginCommands::Build(args) => run_build(args).await,
|
||||
PluginCommands::Dev(args) => run_dev(args).await,
|
||||
PluginCommands::Generate(args) => run_generate(args).await,
|
||||
PluginCommands::Publish(args) => run_publish(args).await,
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn run_dev(args: PluginPathArg) -> i32 {
|
||||
match dev(args).await {
|
||||
Ok(()) => 0,
|
||||
|
||||
@@ -48,10 +48,7 @@ async fn main() {
|
||||
|
||||
let exit_code = match command {
|
||||
Commands::Auth(args) => commands::auth::run(args).await,
|
||||
Commands::Build(args) => commands::plugin::run_build(args).await,
|
||||
Commands::Dev(args) => commands::plugin::run_dev(args).await,
|
||||
Commands::Generate(args) => commands::plugin::run_generate(args).await,
|
||||
Commands::Publish(args) => commands::plugin::run_publish(args).await,
|
||||
Commands::Plugin(args) => commands::plugin::run(args).await,
|
||||
Commands::Send(args) => {
|
||||
commands::send::run(
|
||||
context.as_ref().expect("context initialized for send"),
|
||||
|
||||
Reference in New Issue
Block a user