aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/ttyplay/main.rs18
-rw-r--r--src/bin/ttyrec/main.rs13
2 files changed, 17 insertions, 14 deletions
diff --git a/src/bin/ttyplay/main.rs b/src/bin/ttyplay/main.rs
index 832b870..0cf7427 100644
--- a/src/bin/ttyplay/main.rs
+++ b/src/bin/ttyplay/main.rs
@@ -11,14 +11,16 @@
#![allow(clippy::too_many_lines)]
#![allow(clippy::type_complexity)]
+use clap::Parser as _;
+
mod display;
mod event;
mod frames;
mod input;
mod timer;
-#[derive(Debug, structopt::StructOpt)]
-#[structopt(
+#[derive(Debug, clap::Parser)]
+#[command(
name = "ttyplay",
about = "Plays back ttyrec files",
long_about = "\n\
@@ -29,7 +31,7 @@ mod timer;
paused."
)]
struct Opt {
- #[structopt(
+ #[arg(
short,
long,
default_value = "ttyrec",
@@ -37,16 +39,16 @@ struct Opt {
)]
file: std::ffi::OsString,
- #[structopt(
+ #[arg(
long,
help = "Restrict time between frames to at most this many milliseconds"
)]
clamp: Option<u64>,
- #[structopt(short, long, help = "Start the player paused")]
+ #[arg(short, long, help = "Start the player paused")]
paused: bool,
- #[structopt(
+ #[arg(
short,
long,
default_value = "4",
@@ -100,8 +102,8 @@ async fn async_main(opt: Opt) -> anyhow::Result<()> {
Ok(())
}
-#[paw::main]
-fn main(opt: Opt) {
+fn main() {
+ let opt = Opt::parse();
match async_main(opt) {
Ok(_) => (),
Err(e) => {
diff --git a/src/bin/ttyrec/main.rs b/src/bin/ttyrec/main.rs
index 1dbba54..1a3c03d 100644
--- a/src/bin/ttyrec/main.rs
+++ b/src/bin/ttyrec/main.rs
@@ -11,10 +11,11 @@
#![allow(clippy::too_many_lines)]
#![allow(clippy::type_complexity)]
+use clap::Parser as _;
use tokio::io::{AsyncReadExt as _, AsyncWriteExt as _};
-#[derive(Debug, structopt::StructOpt)]
-#[structopt(
+#[derive(Debug, clap::Parser)]
+#[command(
name = "ttyrec",
about = "Records ttyrec files",
long_about = "\n\
@@ -23,7 +24,7 @@ use tokio::io::{AsyncReadExt as _, AsyncWriteExt as _};
for later playback (such as via the included `ttyplay` command)."
)]
struct Opt {
- #[structopt(
+ #[arg(
short,
long,
default_value = "ttyrec",
@@ -31,7 +32,7 @@ struct Opt {
)]
file: std::ffi::OsString,
- #[structopt(short, long, help = "Command to run [default: $SHELL]")]
+ #[arg(short, long, help = "Command to run [default: $SHELL]")]
cmd: Option<std::ffi::OsString>,
}
@@ -206,8 +207,8 @@ async fn async_main(opt: Opt) -> anyhow::Result<()> {
Ok(())
}
-#[paw::main]
-fn main(opt: Opt) {
+fn main() {
+ let opt = Opt::parse();
match async_main(opt) {
Ok(_) => (),
Err(e) => {