-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |