From 56fac5be13697b7d5a5ba818bbdc28b6a099a657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Zemanovi=C4=8D?= Date: Wed, 7 Feb 2024 11:32:34 +0000 Subject: [PATCH 1/2] cli: allow to use global args at any position (before or after subcmd) --- crates/apps/src/lib/cli.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/apps/src/lib/cli.rs b/crates/apps/src/lib/cli.rs index 3e84538f0f..be2b58abb5 100644 --- a/crates/apps/src/lib/cli.rs +++ b/crates/apps/src/lib/cli.rs @@ -3155,8 +3155,8 @@ pub mod args { /// Add global args definition. Should be added to every top-level /// command. pub fn def(app: App) -> App { - app.arg(CHAIN_ID_OPT.def().help("The chain ID.")) - .arg(BASE_DIR.def().help( + app.arg(CHAIN_ID_OPT.def().global(true).help("The chain ID.")) + .arg(BASE_DIR.def().global(true).help( "The base directory is where the nodes, client and wallet \ configuration and state is stored. This value can also \ be set via `NAMADA_BASE_DIR` environment variable, but \ @@ -3166,7 +3166,7 @@ pub mod args { Unix,`$HOME/Library/Application Support/Namada` on \ Mac,and `%AppData%\\Namada` on Windows.", )) - .arg(WASM_DIR.def().help( + .arg(WASM_DIR.def().global(true).help( "Directory with built WASM validity predicates, \ transactions. This value can also be set via \ `NAMADA_WASM_DIR` environment variable, but the argument \ @@ -3175,6 +3175,7 @@ pub mod args { .arg( PRE_GENESIS .def() + .global(true) .help("Dispatch pre-genesis specific logic."), ) } From f89f894ec8bc004fcc6759a8f9f1f2bbfbdad4d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Zemanovi=C4=8D?= Date: Wed, 7 Feb 2024 11:37:27 +0000 Subject: [PATCH 2/2] changelog: add #2545 --- .../improvements/2545-cli-flexible-global-args-pos.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/unreleased/improvements/2545-cli-flexible-global-args-pos.md diff --git a/.changelog/unreleased/improvements/2545-cli-flexible-global-args-pos.md b/.changelog/unreleased/improvements/2545-cli-flexible-global-args-pos.md new file mode 100644 index 0000000000..450a0e7e78 --- /dev/null +++ b/.changelog/unreleased/improvements/2545-cli-flexible-global-args-pos.md @@ -0,0 +1,3 @@ +- CLI: Allow to use global args (`--chain-id`, `--base-dir`, `--wasm-dir` and + `--pre-genesis`) before or after a sub-command. + ([\#2545](https://github.com/anoma/namada/pull/2545)) \ No newline at end of file