1use crate::config::ConfigOverride;
2use anchor_client::Cluster;
3use anyhow::Result;
4use clap::Parser;
5
6mod commands;
7pub mod config;
8mod errors;
9mod path;
10mod utils;
11
12pub const VERSION: &str = env!("CARGO_PKG_VERSION");
13
14#[derive(Parser, Debug)]
15#[clap(version = VERSION)]
16pub struct Opts {
17 #[clap(flatten)]
18 pub cfg_override: ConfigOverride,
19
20 #[clap(subcommand)]
21 command: Command,
22}
23
24#[derive(Debug, Parser)]
25pub enum Command {
26 Init,
28 Instance,
30 Deploy {
32 cluster: Cluster,
34
35 #[clap(long)]
37 command: Option<String>,
38 },
39}
40
41pub fn entry(opts: Opts) -> Result<()> {
42 match opts.command {
43 Command::Init => commands::init(),
44 Command::Instance => commands::instance(),
45 Command::Deploy { cluster, command } => {
46 commands::deploy(&opts.cfg_override, cluster, command)
47 }
48 }
49}