mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-07-12 15:52:57 +02:00
Move build/dev/generate/publish under plugin command
This commit is contained in:
@@ -26,17 +26,8 @@ pub enum Commands {
|
|||||||
/// Authentication commands
|
/// Authentication commands
|
||||||
Auth(AuthArgs),
|
Auth(AuthArgs),
|
||||||
|
|
||||||
/// Transpile code into a runnable plugin bundle
|
/// Plugin development and publishing commands
|
||||||
Build(PluginPathArg),
|
Plugin(PluginArgs),
|
||||||
|
|
||||||
/// 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),
|
|
||||||
|
|
||||||
/// Send a request, folder, or workspace by ID
|
/// Send a request, folder, or workspace by ID
|
||||||
Send(SendArgs),
|
Send(SendArgs),
|
||||||
@@ -339,6 +330,27 @@ pub enum AuthCommands {
|
|||||||
Whoami,
|
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)]
|
#[derive(Args, Clone)]
|
||||||
pub struct PluginPathArg {
|
pub struct PluginPathArg {
|
||||||
/// Path to plugin directory (defaults to current working directory)
|
/// 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 crate::ui;
|
||||||
use keyring::Entry;
|
use keyring::Entry;
|
||||||
use rand::Rng;
|
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 {
|
pub async fn run_dev(args: PluginPathArg) -> i32 {
|
||||||
match dev(args).await {
|
match dev(args).await {
|
||||||
Ok(()) => 0,
|
Ok(()) => 0,
|
||||||
|
|||||||
@@ -48,10 +48,7 @@ async fn main() {
|
|||||||
|
|
||||||
let exit_code = match command {
|
let exit_code = match command {
|
||||||
Commands::Auth(args) => commands::auth::run(args).await,
|
Commands::Auth(args) => commands::auth::run(args).await,
|
||||||
Commands::Build(args) => commands::plugin::run_build(args).await,
|
Commands::Plugin(args) => commands::plugin::run(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::Send(args) => {
|
Commands::Send(args) => {
|
||||||
commands::send::run(
|
commands::send::run(
|
||||||
context.as_ref().expect("context initialized for send"),
|
context.as_ref().expect("context initialized for send"),
|
||||||
|
|||||||
Reference in New Issue
Block a user