mod agents;
mod bootstrap;
mod harness;
mod herdr_cli;
mod install;
mod known_hosts;
mod new;
mod relay;
mod state;
mod sync;
mod target;
mod watch;
use anyhow::Result;
use clap::Parser;
pub const PLUGIN_ID: &str = "railway.ca";
#[derive(Parser)]
pub struct Args {
#[clap(subcommand)]
command: Command,
}
#[derive(Parser)]
enum Command {
Install(install::Args),
New(new::Args),
Agents(agents::Args),
Sync(sync::Args),
Bootstrap(bootstrap::Args),
Watch(watch::Args),
}
pub async fn command(args: Args) -> Result<()> {
match args.command {
Command::Install(a) => install::command(a).await,
Command::New(a) => new::command(a).await,
Command::Agents(a) => agents::command(a).await,
Command::Sync(a) => sync::command(a).await,
Command::Bootstrap(a) => bootstrap::command(a).await,
Command::Watch(a) => watch::command(a).await,
}
}
pub fn plugin_dir() -> Result<std::path::PathBuf> {
let home = dirs::home_dir().ok_or_else(|| anyhow::anyhow!("Unable to get home directory"))?;
Ok(home.join(".railway").join("herdr-plugin"))
}