Skip to content

Commit 83abcd9

Browse files
committed
Group help options into sections in command help.
1 parent 630619d commit 83abcd9

6 files changed

Lines changed: 1261 additions & 913 deletions

File tree

FULL_HELP_DOCS.md

Lines changed: 1216 additions & 898 deletions
Large diffs are not rendered by default.

cmd/soroban-cli/src/commands/message/sign.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use clap::Parser;
55
use sha2::{Digest, Sha256};
66

77
use crate::{
8-
commands::global,
8+
commands::{global, HEADING_SIGNING},
99
config::{locator, secret},
1010
print::Print,
1111
signer::{self, Signer},
@@ -57,10 +57,15 @@ pub struct Cmd {
5757

5858
// @dev: Ledger and Lab don't support signing arbitrary messages yet. Once they do, use `sign_with::Args` here.
5959
/// Sign with a local key or key saved in OS secure storage. Can be an identity (--sign-with-key alice), a secret key (--sign-with-key SC36…), or a seed phrase (--sign-with-key "kite urban…"). If using seed phrase, `--hd-path` defaults to the `0` path.
60-
#[arg(long, env = "STELLAR_SIGN_WITH_KEY", hide_env_values = true)]
60+
#[arg(
61+
long,
62+
env = "STELLAR_SIGN_WITH_KEY",
63+
hide_env_values = true,
64+
help_heading = HEADING_SIGNING
65+
)]
6166
pub sign_with_key: String,
6267

63-
#[arg(long)]
68+
#[arg(long, help_heading = HEADING_SIGNING)]
6469
/// If using a seed phrase to sign, sets which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0`
6570
pub hd_path: Option<usize>,
6671

cmd/soroban-cli/src/commands/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ pub mod version;
2626

2727
pub mod txn_result;
2828

29-
pub const HEADING_RPC: &str = "Options (RPC)";
30-
pub const HEADING_ARCHIVE: &str = "Options (Archive)";
31-
pub const HEADING_GLOBAL: &str = "Options (Global)";
29+
pub const HEADING_RPC: &str = "RPC Options";
30+
pub const HEADING_ARCHIVE: &str = "Archive Options";
31+
pub const HEADING_GLOBAL: &str = "Global Options";
32+
pub const HEADING_SIGNING: &str = "Signing Options";
33+
pub const HEADING_TRANSACTION: &str = "Transaction Options";
3234
const ABOUT: &str =
3335
"Work seamlessly with Stellar accounts, contracts, and assets from the command line.
3436

cmd/soroban-cli/src/commands/tx/args.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::{
2-
commands::{global, txn_result::TxnEnvelopeResult},
2+
commands::{global, txn_result::TxnEnvelopeResult, HEADING_TRANSACTION},
33
config::{
44
self,
55
address::{self, UnresolvedMuxedAccount},
@@ -16,7 +16,7 @@ pub struct Args {
1616
#[clap(flatten)]
1717
pub config: config::Args,
1818
/// Build the transaction and only write the base64 xdr to stdout
19-
#[arg(long)]
19+
#[arg(long, help_heading = HEADING_TRANSACTION)]
2020
pub build_only: bool,
2121
}
2222

cmd/soroban-cli/src/config/mod.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::{
55
};
66

77
use crate::{
8+
commands::HEADING_TRANSACTION,
89
print::Print,
910
signer::{self, Signer},
1011
utils::deprecate_message,
@@ -59,7 +60,13 @@ pub struct Args {
5960
#[command(flatten)]
6061
pub network: network::Args,
6162

62-
#[arg(long, short = 's', visible_alias = "source", env = "STELLAR_ACCOUNT")]
63+
#[arg(
64+
long,
65+
short = 's',
66+
visible_alias = "source",
67+
env = "STELLAR_ACCOUNT",
68+
help_heading = HEADING_TRANSACTION
69+
)]
6370
/// Account that where transaction originates from. Alias `source`.
6471
/// Can be an identity (--source alice), a public key (--source GDKW...),
6572
/// a muxed account (--source MDA…), a secret key (--source SC36…),
@@ -75,11 +82,15 @@ pub struct Args {
7582
pub sign_with: sign_with::Args,
7683

7784
/// ⚠️ Deprecated, use `--inclusion-fee`. Fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm
78-
#[arg(long, env = "STELLAR_FEE")]
85+
#[arg(long, env = "STELLAR_FEE", help_heading = HEADING_TRANSACTION)]
7986
pub fee: Option<u32>,
8087

8188
/// Maximum fee amount for transaction inclusion, in stroops. 1 stroop = 0.0000001 xlm. Defaults to 100 if no arg, env, or config value is provided
82-
#[arg(long, env = "STELLAR_INCLUSION_FEE")]
89+
#[arg(
90+
long,
91+
env = "STELLAR_INCLUSION_FEE",
92+
help_heading = HEADING_TRANSACTION
93+
)]
8394
pub inclusion_fee: Option<u32>,
8495
}
8596

cmd/soroban-cli/src/config/sign_with.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use super::{
1010
network::{self, Network},
1111
secret,
1212
};
13+
use crate::commands::HEADING_SIGNING;
1314

1415
#[derive(thiserror::Error, Debug)]
1516
pub enum Error {
@@ -37,24 +38,35 @@ pub enum Error {
3738
#[group(skip)]
3839
pub struct Args {
3940
/// Sign with a local key or key saved in OS secure storage. Can be an identity (--sign-with-key alice), a secret key (--sign-with-key SC36…), or a seed phrase (--sign-with-key "kite urban…"). If using seed phrase, `--hd-path` defaults to the `0` path.
40-
#[arg(long, env = "STELLAR_SIGN_WITH_KEY", hide_env_values = true)]
41+
#[arg(
42+
long,
43+
env = "STELLAR_SIGN_WITH_KEY",
44+
hide_env_values = true,
45+
help_heading = HEADING_SIGNING
46+
)]
4147
pub sign_with_key: Option<String>,
4248

43-
#[arg(long, conflicts_with = "sign_with_lab")]
49+
#[arg(long, conflicts_with = "sign_with_lab", help_heading = HEADING_SIGNING)]
4450
/// If using a seed phrase to sign, sets which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0`
4551
pub hd_path: Option<usize>,
4652

4753
#[allow(clippy::doc_markdown)]
4854
/// Sign with https://lab.stellar.org
49-
#[arg(long, conflicts_with = "sign_with_key", env = "STELLAR_SIGN_WITH_LAB")]
55+
#[arg(
56+
long,
57+
conflicts_with = "sign_with_key",
58+
env = "STELLAR_SIGN_WITH_LAB",
59+
help_heading = HEADING_SIGNING
60+
)]
5061
pub sign_with_lab: bool,
5162

5263
/// Sign with a ledger wallet
5364
#[arg(
5465
long,
5566
conflicts_with = "sign_with_key",
5667
conflicts_with = "sign_with_lab",
57-
env = "STELLAR_SIGN_WITH_LEDGER"
68+
env = "STELLAR_SIGN_WITH_LEDGER",
69+
help_heading = HEADING_SIGNING
5870
)]
5971
pub sign_with_ledger: bool,
6072
}

0 commit comments

Comments
 (0)