Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit cae1ded

Browse files
committed
single-pool-cli: replace OutputFormatArg
1 parent 871dd70 commit cae1ded

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

single-pool/cli/src/cli.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use {
99
input_validators::{is_valid_pubkey, is_valid_signer},
1010
keypair::{pubkey_from_path, signer_from_path},
1111
},
12+
solana_cli_output::OutputFormat,
1213
solana_remote_wallet::remote_wallet::RemoteWalletManager,
1314
solana_sdk::{pubkey::Pubkey, signer::Signer},
1415
spl_single_pool::{self, find_pool_address},
@@ -61,7 +62,7 @@ pub struct Cli {
6162
conflicts_with = "verbose",
6263
value_parser = PossibleValuesParser::new(["json", "json-compact"]).map(|o| parse_output_format(&o)),
6364
)]
64-
pub output_format: Option<OutputFormatArg>,
65+
pub output_format: Option<OutputFormat>,
6566

6667
#[clap(subcommand)]
6768
pub command: Command,
@@ -313,10 +314,10 @@ pub fn parse_address(path: &str, name: &str) -> Result<Pubkey, String> {
313314
}
314315
}
315316

316-
pub fn parse_output_format(output_format: &str) -> OutputFormatArg {
317+
pub fn parse_output_format(output_format: &str) -> OutputFormat {
317318
match output_format {
318-
"json" => OutputFormatArg::Json,
319-
"json-compact" => OutputFormatArg::JsonCompact,
319+
"json" => OutputFormat::Json,
320+
"json-compact" => OutputFormat::JsonCompact,
320321
_ => unreachable!(),
321322
}
322323
}
@@ -451,10 +452,3 @@ pub fn with_signer(
451452
a => a,
452453
})
453454
}
454-
455-
// TODO replace with monorepo OutputFormat once it has Clone
456-
#[derive(Clone, Debug, PartialEq, Eq)]
457-
pub enum OutputFormatArg {
458-
Json,
459-
JsonCompact,
460-
}

single-pool/cli/src/config.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ impl Config {
8585

8686
// determine output format
8787
let output_format = match (cli.output_format, cli.verbose) {
88-
(Some(OutputFormatArg::Json), _) => OutputFormat::Json,
89-
(Some(OutputFormatArg::JsonCompact), _) => OutputFormat::JsonCompact,
88+
(Some(json_format), _) => json_format,
9089
(None, true) => OutputFormat::DisplayVerbose,
9190
(None, false) => OutputFormat::Display,
9291
};

0 commit comments

Comments
 (0)