solana_clap_utils/
lib.rs

1use thiserror::Error;
2
3pub struct ArgConstant<'a> {
4    pub long: &'a str,
5    pub name: &'a str,
6    pub help: &'a str,
7}
8
9/// Error type for forwarding Errors out of `main()` of a `clap` app
10/// and still using the `Display` formatter
11#[derive(Error)]
12#[error("{0}")]
13pub struct DisplayError(Box<dyn std::error::Error>);
14impl DisplayError {
15    pub fn new_as_boxed(inner: Box<dyn std::error::Error>) -> Box<Self> {
16        DisplayError(inner).into()
17    }
18}
19
20impl std::fmt::Debug for DisplayError {
21    fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
22        write!(fmt, "{}", self.0)
23    }
24}
25
26pub fn hidden_unless_forced() -> bool {
27    std::env::var("SOLANA_NO_HIDDEN_CLI_ARGS").is_err()
28}
29
30pub mod compute_budget;
31pub mod compute_unit_price;
32pub mod fee_payer;
33pub mod input_parsers;
34pub mod input_validators;
35pub mod keypair;
36pub mod memo;
37pub mod nonce;
38pub mod offline;