Skip to content

Commit

Permalink
Merge pull request #5 from tonton-sol/build-command
Browse files Browse the repository at this point in the history
add build command
  • Loading branch information
tonton-sol authored Sep 28, 2024
2 parents c280bd6 + 21ded1b commit ae85a44
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ enum Commands {
UpdateExtraMetas(UpdateExtraMetasArgs),
#[command(about = "Deploy the program")]
Deploy(DeployArgs),
#[command(about = "Build the program")]
Build(BuildArgs),
}

#[derive(Parser)]
Expand Down Expand Up @@ -130,6 +132,9 @@ struct DeployArgs {
max_sign_attempts: Option<String>,
}

#[derive(Parser)]
struct BuildArgs {}

struct Config {
rpc: String,
keypair: String,
Expand Down Expand Up @@ -174,6 +179,7 @@ fn main() {
Commands::CreateExtraMetas(args) => create_extra_metas(args, config).unwrap(),
Commands::UpdateExtraMetas(args) => update_extra_metas(args, config).unwrap(),
Commands::Deploy(args) => deploy(args, config).unwrap(),
Commands::Build(args) => build(args, config).unwrap(),
}
}

Expand All @@ -183,6 +189,17 @@ fn new(args: NewArgs, config: Config) -> Result<(), Box<dyn std::error::Error>>
create_new_project(&args.path, &name)
}

fn build(_args: BuildArgs, _config: Config) -> Result<(), Box<dyn std::error::Error>> {
println!("Building the program...");

let mut command = std::process::Command::new("cargo");
command
.arg("build-bpf")
.stdout(Stdio::inherit())
.stderr(Stdio::inherit());
Ok(())
}

fn deploy(args: DeployArgs, config: Config) -> Result<(), Box<dyn std::error::Error>> {
println!("Creating extra account metas...");

Expand Down

0 comments on commit ae85a44

Please sign in to comment.