Skip to content

Commit

Permalink
feat: add help headings for global command options (#1696)
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal authored Nov 1, 2024
1 parent 519c6fa commit bd1ef30
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
12 changes: 6 additions & 6 deletions cmd/soroban-cli/src/commands/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use clap::{
};
use std::path::PathBuf;

use super::config;
use super::{config, HEADING_GLOBAL};

const USAGE_STYLES: Styles = Styles::styled()
.header(AnsiColor::Green.on_default().effects(Effects::BOLD))
Expand All @@ -24,27 +24,27 @@ pub struct Args {
pub locator: config::locator::Args,

/// Filter logs output. To turn on `stellar_cli::log::footprint=debug` or off `=off`. Can also use env var `RUST_LOG`.
#[arg(long, short = 'f', global = true)]
#[arg(long, short = 'f', global = true, help_heading = HEADING_GLOBAL)]
pub filter_logs: Vec<String>,

/// Do not write logs to stderr including `INFO`
#[arg(long, short = 'q', global = true)]
#[arg(long, short = 'q', global = true, help_heading = HEADING_GLOBAL)]
pub quiet: bool,

/// Log DEBUG events
#[arg(long, short = 'v', global = true)]
#[arg(long, short = 'v', global = true, help_heading = HEADING_GLOBAL)]
pub verbose: bool,

/// Log DEBUG and TRACE events
#[arg(long, visible_alias = "vv", global = true)]
#[arg(long, visible_alias = "vv", global = true, help_heading = HEADING_GLOBAL)]
pub very_verbose: bool,

/// List installed plugins. E.g. `stellar-hello`
#[arg(long)]
pub list: bool,

/// Do not cache your simulations and transactions
#[arg(long, env = "STELLAR_NO_CACHE", global = true)]
#[arg(long, env = "STELLAR_NO_CACHE", global = true, help_heading = HEADING_GLOBAL)]
pub no_cache: bool,
}

Expand Down
1 change: 1 addition & 0 deletions cmd/soroban-cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub mod version;
pub mod txn_result;

pub const HEADING_RPC: &str = "Options (RPC)";
pub const HEADING_GLOBAL: &str = "Options (Global)";
const ABOUT: &str =
"Work seamlessly with Stellar accounts, contracts, and assets from the command line.
Expand Down
6 changes: 3 additions & 3 deletions cmd/soroban-cli/src/config/locator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::{
};
use stellar_strkey::{Contract, DecodeError};

use crate::{utils::find_config_dir, Pwd};
use crate::{commands::HEADING_GLOBAL, utils::find_config_dir, Pwd};

use super::{
alias,
Expand Down Expand Up @@ -82,11 +82,11 @@ pub enum Error {
#[group(skip)]
pub struct Args {
/// Use global config
#[arg(long, global = true)]
#[arg(long, global = true, help_heading = HEADING_GLOBAL)]
pub global: bool,

/// Location of config directory, default is "."
#[arg(long, global = true)]
#[arg(long, global = true, help_heading = HEADING_GLOBAL)]
pub config_dir: Option<PathBuf>,
}

Expand Down

0 comments on commit bd1ef30

Please sign in to comment.