Skip to content

Commit 098af1b

Browse files
committed
feat: add --print-tui-items option to display all tui color options and exit
1 parent bbc5449 commit 098af1b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/config.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ use anyhow::anyhow;
22
use clap::{Parser, ValueEnum};
33
use std::collections::HashMap;
44
use std::net::IpAddr;
5+
use std::process;
56
use std::str::FromStr;
67
use std::time::Duration;
7-
use strum::{EnumString, EnumVariantNames};
8+
use strum::{EnumString, EnumVariantNames, VariantNames};
89
use trippy::tracing::{MultipathStrategy, PortDirection, TracerAddrFamily, TracerProtocol};
910

1011
/// The maximum number of hops we allow.
@@ -271,6 +272,10 @@ pub struct Args {
271272
#[clap(long, num_args(0..), value_delimiter(','), value_parser = parse_tui_color_value, display_order = 31)]
272273
pub tui_color: Vec<Option<(TuiItem, TuiColor)>>,
273274

275+
/// Print all TUI theme items and exit
276+
#[clap(long, display_order = 32)]
277+
pub print_tui_items: bool,
278+
274279
/// The number of report cycles to run
275280
#[clap(
276281
short = 'c',
@@ -522,6 +527,10 @@ impl TryFrom<(Args, u16)> for TrippyConfig {
522527
#[allow(clippy::too_many_lines)]
523528
fn try_from(data: (Args, u16)) -> Result<Self, Self::Error> {
524529
let (args, pid) = data;
530+
if args.print_tui_items {
531+
println!("TUI theme color items: {}", TuiItem::VARIANTS.join(", "));
532+
process::exit(0);
533+
}
525534
let protocol = match (args.udp, args.tcp, args.protocol) {
526535
(false, false, Protocol::Icmp) => TracerProtocol::Icmp,
527536
(false, false, Protocol::Udp) | (true, _, _) => TracerProtocol::Udp,

0 commit comments

Comments
 (0)