Skip to content

Commit

Permalink
feat: add --print-tui-items option to display all tui color options a…
Browse files Browse the repository at this point in the history
…nd exit
  • Loading branch information
fujiapple852 committed Mar 20, 2023
1 parent c4e91c0 commit 2685d5d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use anyhow::anyhow;
use clap::{Parser, ValueEnum};
use std::collections::HashMap;
use std::net::IpAddr;
use std::process;
use std::str::FromStr;
use std::time::Duration;
use strum::{EnumString, EnumVariantNames};
use strum::{EnumString, EnumVariantNames, VariantNames};
use trippy::tracing::{MultipathStrategy, PortDirection, TracerAddrFamily, TracerProtocol};

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

/// Print all TUI theme items and exit
#[clap(long, display_order = 32)]
pub print_tui_items: bool,

/// The number of report cycles to run
#[clap(
short = 'c',
Expand Down Expand Up @@ -521,6 +526,10 @@ impl TryFrom<(Args, u16)> for TrippyConfig {
#[allow(clippy::too_many_lines)]
fn try_from(data: (Args, u16)) -> Result<Self, Self::Error> {
let (args, pid) = data;
if args.print_tui_items {
println!("TUI theme color items: {}", TuiItem::VARIANTS.join(", "));
process::exit(0);
}
let protocol = match (args.udp, args.tcp, args.protocol) {
(false, false, Protocol::Icmp) => TracerProtocol::Icmp,
(false, false, Protocol::Udp) | (true, _, _) => TracerProtocol::Udp,
Expand Down

0 comments on commit 2685d5d

Please sign in to comment.