Skip to content

cli: add --solana-url and --verbose global flags#3754

Open
juan-malbeclabs wants to merge 2 commits into
jo/1-cli-core-foundationfrom
jo/2-cli-global-flags
Open

cli: add --solana-url and --verbose global flags#3754
juan-malbeclabs wants to merge 2 commits into
jo/1-cli-core-foundationfrom
jo/2-cli-global-flags

Conversation

@juan-malbeclabs
Copy link
Copy Markdown
Contributor

@juan-malbeclabs juan-malbeclabs commented May 22, 2026

RFC-20 implementation stack

This PR is part of a 9-PR chain delivering RFC-20: CLI standardization. Each PR's diff is only its own contribution; reviewers should consume them in order.

# PR Scope
1 #3753 doublezero-cli-core foundation crate + solana_l1_rpc_url
2 #3754 --solana-url + --log-verbose global flags + tracing init
3 #3755 CliContext built in main + centralized error rendering
4 #3756 rename doublezero_clidoublezero-serviceability-cli
5 #3757 rewrite location get as the async + CliContext reference verb
6 #3758 docs/cli-standard.md + CLAUDE.md pointer
7 #3759 move per-resource subcommand wrappers into the module crate
8 #3760 add ServiceabilityCommand enum + async dispatcher
9 #3761 #[command(flatten)] + collapse binary dispatch

This PR: #3754 — position 2 of 9. Previous: #3753 · Next: #3755


Summary of Changes

  • Adds the --solana-url <SOLANA_RPC_URL> global flag to doublezero per RFC-20 §Global flags. Distinct from --url, which continues to override the DZ ledger transport; --solana-url targets the Solana L1 transport. The flag is parsed and exposed on the binary's App struct; per-verb consumption lands when verbs migrate to construct typed Solana L1 clients from CliContext (follow-up PRs).
  • Adds the --verbose / -v (repeatable) global flag and initializes the tracing subscriber at startup via doublezero_cli_core::init_logging(verbosity). Default level is warn; -v raises to debug, -vv to trace. Honors the RUST_LOG env var when set. Diagnostic logs go to stderr so --json output on stdout remains parseable.
  • Replaces the println!("using keypair: ...") startup line with a tracing::info! event so the keypair confirmation now appears only at -v or higher and no longer pollutes parseable stdout.

Diff Breakdown

Category Files Lines (+/-) Net
Core logic 1 +13 / -1 +12
Config/build 2 +3 / -0 +3
Docs 1 +2 / -0 +2
Total 4 +18 / -1 +17

Three new global flags wired into the binary and the logging facade; no changes to subcommand dispatch or verb behavior.

Key files (click to expand)
  • client/doublezero/src/main.rs - adds solana_url and verbose fields to the App struct, calls doublezero_cli_core::init_logging(app.verbose) first thing in main, and replaces the println! keypair confirmation with tracing::info!.
  • client/doublezero/Cargo.toml - depends on doublezero-cli-core and tracing.

Testing Verification

  • make rust-lint clean.
  • doublezero --help shows the new --solana-url and --verbose / -v global flags with the expected help text.
  • doublezero --keypair /tmp/fake.json --env local -v address emits a tracing::info! event with the keypair path on stderr while stdout shows only the address; no -v keeps stderr empty.
  • Built on top of cli/core: introduce doublezero-cli-core crate and solana_l1_rpc_url #3753 (foundation crate); this PR targets jo/1-cli-core-foundation and the diff shown is its own contribution only.

`--env` now conflicts with `--url`, `--ws`, `--solana-url`,
`--program-id`, and `--geo-program-id` via clap. Combining them used
to be silently inconsistent: per-field overrides won over env defaults
on some fields and not others, so e.g. `--env devnet --url <custom>`
would pair the custom RPC URL with devnet's default WebSocket URL.

Clap now rejects the combination upfront with a clear usage error,
matching the design rule that `--env` selects a full preset wholesale.
Adds clap-parse tests covering each conflict pair and the positive
single-flag cases.
@juan-malbeclabs juan-malbeclabs force-pushed the jo/2-cli-global-flags branch from 7a7f8b6 to 19c7707 Compare May 24, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant