Skip to content

Commit

Permalink
[cli] update to clap version 4.
Browse files Browse the repository at this point in the history
  • Loading branch information
youngman-g committed Jul 6, 2023
1 parent eb32020 commit c17afb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ cpu = {path = "../cpu" }
base = {path = "../base" }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
clap = { version = "3", features = ["derive"] }
termcolor = "1" # Unlicense OR MIT license
atty = "0.2" # MIT license
clap = { version = "4", features = ["derive"] }
termcolor = "1" # Unlicense OR MIT license
atty = "0.2" # MIT license
12 changes: 6 additions & 6 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::io::{BufReader, Read};
use std::str::FromStr;
use std::time::Duration;

use clap::{ArgAction::Set, ArgEnum, Parser};
use clap::{ArgAction::Set, Parser, ValueEnum};
use tracing::{event, Level};
use tracing_subscriber::filter::{EnvFilter, LevelFilter};
use tracing_subscriber::prelude::*;
Expand Down Expand Up @@ -145,7 +145,7 @@ fn run_until_alarm(
}

/// Whether to panic when there was an unmasked alarm.
#[derive(Debug, Clone, PartialEq, Eq, ArgEnum)]
#[derive(Debug, Clone, PartialEq, Eq, ValueEnum)]
enum PanicOnUnmaskedAlarm {
// Panic when an unmasked alarm occurs. If the RUST_BACKTRACE
// environment variable is also set, a stack backtrace will be
Expand Down Expand Up @@ -173,20 +173,20 @@ impl FromStr for PanicOnUnmaskedAlarm {

/// Command-line simulator for the historical TX-2 computer
#[derive(Parser, Debug)]
#[clap(author = AUTHOR, version, about, long_about = None)]
#[command(author = AUTHOR, version, about, long_about = None)]
struct Cli {
/// Run this many times faster than real-time ('MAX' for as-fast-as-possible)
#[clap(action = Set, long = "speed-multiplier")]
#[arg(action = Set, long = "speed-multiplier")]
speed_multiplier: Option<String>,

/// When set, panic if an alarm occurs (so that a stack backtrace
/// is produced when the RUST_BACKTRACE environment variable is
/// also set). When unset, stop the emulator without panic.
#[clap(action = Set, long = "panic-on-unmasked-alarm", arg_enum)]
#[arg(action = Set, long = "panic-on-unmasked-alarm", value_enum)]
panic_on_unmasked_alarm: Option<PanicOnUnmaskedAlarm>,

/// File containing paper tape data
#[clap(action = Set)]
#[arg(action = Set)]
tape: Option<OsString>,
}

Expand Down

0 comments on commit c17afb3

Please sign in to comment.