Skip to content

Commit

Permalink
Skeleton CLI binary
Browse files Browse the repository at this point in the history
  • Loading branch information
rakanalh committed Feb 3, 2025
1 parent 84e51db commit 7d773a3
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ resolver = "2"
members = [
# Citrea
"bin/citrea",
"bin/cli",
"crates/batch-prover",
"crates/bitcoin-da",
"crates/citrea-stf",
Expand Down
24 changes: 24 additions & 0 deletions bin/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "citrea-cli"
version = { workspace = true }
authors = { workspace = true }
edition = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
publish = false
resolver = "2"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# Citrea deps

# Sovereign-SDK deps

# 3rd-party deps
clap = { workspace = true }
tokio = { workspace = true }

[[bin]]
name = "citrea-cli"
path = "src/main.rs"
38 changes: 38 additions & 0 deletions bin/cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
use std::path::PathBuf;

use clap::{Parser, Subcommand};

#[derive(Parser)]
#[command(version, about, long_about = None)]
#[command(propagate_version = true)]
struct Cli {
#[command(subcommand)]
command: Commands,
}

#[derive(Subcommand)]
enum Commands {
/// Prune database
Prune {
db_path: PathBuf,
},
Rollback {
db_path: PathBuf,
},
}

#[tokio::main]
async fn main() {
let cli = Cli::parse();

// You can check for the existence of subcommands, and if found use their
// matches just as you would the top level cmd
match &cli.command {
Commands::Prune { db_path } => {
println!("Pruning stuff: {:?}", db_path);
}
Commands::Rollback { db_path } => {
println!("Rolling back stuff: {:?}", db_path);
}
}
}

0 comments on commit 7d773a3

Please sign in to comment.