Skip to content

Commit

Permalink
chore(zkstack_cli): Rename inception to zkstack (#3123)
Browse files Browse the repository at this point in the history
## What ❔

<!-- What are the changes this PR brings about? -->
<!-- Example: This PR adds a PR template to the repo. -->
<!-- (For bigger PRs adding more context is appreciated) -->
Rename `Inception` to `ZkStack`, and `InceptionSubcommands` to
`ZkStackSubcommands`.

## Why ❔

<!-- Why are these changes done? What goal do they contribute to? What
are the principles behind them? -->
<!-- Example: PR templates ensure PR reviewers, observers, and future
iterators are in context about the evolution of repos. -->

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [x] Tests for the changes have been added / updated.
- [x] Documentation comments have been added / updated.
- [x] Code has been formatted via `zkstack dev fmt` and `zkstack dev
lint`.
  • Loading branch information
manuelmauro authored Oct 17, 2024
1 parent 9d88373 commit d249059
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions zkstack_cli/crates/zkstack/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ mod utils;
version = version_message(env!("CARGO_PKG_VERSION")),
about
)]
struct Inception {
struct ZkStack {
#[command(subcommand)]
command: InceptionSubcommands,
command: ZkStackSubcommands,
#[clap(flatten)]
global: InceptionGlobalArgs,
global: ZkStackGlobalArgs,
}

#[derive(Subcommand, Debug)]
pub enum InceptionSubcommands {
pub enum ZkStackSubcommands {
/// Ecosystem related commands
#[command(subcommand, alias = "e")]
Ecosystem(Box<EcosystemCommands>),
Expand Down Expand Up @@ -80,7 +80,7 @@ pub enum InceptionSubcommands {

#[derive(Parser, Debug)]
#[clap(next_help_heading = "Global options")]
struct InceptionGlobalArgs {
struct ZkStackGlobalArgs {
/// Verbose mode
#[clap(short, long, global = true)]
verbose: bool,
Expand All @@ -98,7 +98,7 @@ async fn main() -> anyhow::Result<()> {

// We must parse arguments before printing the intro, because some autogenerated
// Clap commands (like `--version` would look odd otherwise).
let inception_args = Inception::parse();
let inception_args = ZkStack::parse();

init_prompt_theme();

Expand All @@ -123,34 +123,32 @@ async fn main() -> anyhow::Result<()> {
Ok(())
}

async fn run_subcommand(inception_args: Inception, shell: &Shell) -> anyhow::Result<()> {
async fn run_subcommand(inception_args: ZkStack, shell: &Shell) -> anyhow::Result<()> {
match inception_args.command {
InceptionSubcommands::Ecosystem(args) => commands::ecosystem::run(shell, *args).await?,
InceptionSubcommands::Chain(args) => commands::chain::run(shell, *args).await?,
InceptionSubcommands::Dev(args) => commands::dev::run(shell, args).await?,
InceptionSubcommands::Prover(args) => commands::prover::run(shell, args).await?,
InceptionSubcommands::Server(args) => commands::server::run(shell, args)?,
InceptionSubcommands::Containers(args) => commands::containers::run(shell, args)?,
InceptionSubcommands::ExternalNode(args) => {
commands::external_node::run(shell, args).await?
}
InceptionSubcommands::ContractVerifier(args) => {
ZkStackSubcommands::Ecosystem(args) => commands::ecosystem::run(shell, *args).await?,
ZkStackSubcommands::Chain(args) => commands::chain::run(shell, *args).await?,
ZkStackSubcommands::Dev(args) => commands::dev::run(shell, args).await?,
ZkStackSubcommands::Prover(args) => commands::prover::run(shell, args).await?,
ZkStackSubcommands::Server(args) => commands::server::run(shell, args)?,
ZkStackSubcommands::Containers(args) => commands::containers::run(shell, args)?,
ZkStackSubcommands::ExternalNode(args) => commands::external_node::run(shell, args).await?,
ZkStackSubcommands::ContractVerifier(args) => {
commands::contract_verifier::run(shell, args).await?
}
InceptionSubcommands::Explorer(args) => commands::explorer::run(shell, args).await?,
InceptionSubcommands::Consensus(cmd) => cmd.run(shell).await?,
InceptionSubcommands::Portal => commands::portal::run(shell).await?,
InceptionSubcommands::Update(args) => commands::update::run(shell, args).await?,
InceptionSubcommands::Markdown => {
clap_markdown::print_help_markdown::<Inception>();
ZkStackSubcommands::Explorer(args) => commands::explorer::run(shell, args).await?,
ZkStackSubcommands::Consensus(cmd) => cmd.run(shell).await?,
ZkStackSubcommands::Portal => commands::portal::run(shell).await?,
ZkStackSubcommands::Update(args) => commands::update::run(shell, args).await?,
ZkStackSubcommands::Markdown => {
clap_markdown::print_help_markdown::<ZkStack>();
}
}
Ok(())
}

fn init_global_config_inner(
shell: &Shell,
inception_args: &InceptionGlobalArgs,
inception_args: &ZkStackGlobalArgs,
) -> anyhow::Result<()> {
if let Some(name) = &inception_args.chain {
if let Ok(config) = EcosystemConfig::from_file(shell) {
Expand Down

0 comments on commit d249059

Please sign in to comment.