Skip to content

Commit

Permalink
refactor: rename inception_args to zkstack_args
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelmauro committed Oct 18, 2024
1 parent 2933c5a commit b172bc6
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions zkstack_cli/crates/zkstack/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ 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 = ZkStack::parse();
let zkstack_args = ZkStack::parse();

match run_subcommand(inception_args).await {
match run_subcommand(zkstack_args).await {
Ok(_) => {}
Err(error) => {
log_error(error);
Expand All @@ -116,21 +116,21 @@ async fn main() -> anyhow::Result<()> {
Ok(())
}

async fn run_subcommand(inception_args: ZkStack) -> anyhow::Result<()> {
async fn run_subcommand(zkstack_args: ZkStack) -> anyhow::Result<()> {
init_prompt_theme();

logger::new_empty_line();
logger::intro();

let shell = Shell::new().unwrap();

init_global_config_inner(&shell, &inception_args.global)?;
init_global_config_inner(&shell, &zkstack_args.global)?;

if !global_config().ignore_prerequisites {
check_general_prerequisites(&shell);
}

match inception_args.command {
match zkstack_args.command {
ZkStackSubcommands::Autocomplete(args) => commands::autocomplete::run(args)?,
ZkStackSubcommands::Ecosystem(args) => commands::ecosystem::run(&shell, *args).await?,
ZkStackSubcommands::Chain(args) => commands::chain::run(&shell, *args).await?,
Expand All @@ -155,11 +155,8 @@ async fn run_subcommand(inception_args: ZkStack) -> anyhow::Result<()> {
Ok(())
}

fn init_global_config_inner(
shell: &Shell,
inception_args: &ZkStackGlobalArgs,
) -> anyhow::Result<()> {
if let Some(name) = &inception_args.chain {
fn init_global_config_inner(shell: &Shell, zkstack_args: &ZkStackGlobalArgs) -> anyhow::Result<()> {
if let Some(name) = &zkstack_args.chain {
if let Ok(config) = EcosystemConfig::from_file(shell) {
let chains = config.list_of_chains();
if !chains.contains(name) {
Expand All @@ -172,9 +169,9 @@ fn init_global_config_inner(
}
}
init_global_config(GlobalConfig {
verbose: inception_args.verbose,
chain_name: inception_args.chain.clone(),
ignore_prerequisites: inception_args.ignore_prerequisites,
verbose: zkstack_args.verbose,
chain_name: zkstack_args.chain.clone(),
ignore_prerequisites: zkstack_args.ignore_prerequisites,
});
Ok(())
}

0 comments on commit b172bc6

Please sign in to comment.