Skip to content

Commit

Permalink
chore: replace structopt with clap
Browse files Browse the repository at this point in the history
  • Loading branch information
maxjoehnk committed Nov 5, 2024
1 parent b2ba12a commit d36ed0d
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 91 deletions.
165 changes: 85 additions & 80 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/mizer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
tracing-appender = "0.2"
tracing = "0.1"
anyhow = "1"
structopt = "0.3"
clap = { version = "4.5", features = ["derive"] }
metrics = "0.24"
mizer-console = { path = "../components/console" }
mizer-media = { path = "../components/media" }
Expand Down
15 changes: 8 additions & 7 deletions crates/mizer/src/flags.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
use std::path::PathBuf;

use structopt::StructOpt;
use clap::Parser;

#[derive(StructOpt, Debug, Clone, Default)]
#[derive(Parser, Debug, Clone, Default)]
#[command(version, about)]
pub struct Flags {
#[structopt(long)]
#[arg(long)]
pub generate_graph: bool,
#[structopt(name = "FILE", parse(from_os_str))]
#[arg(name = "FILE")]
pub file: Option<PathBuf>,
/// Open the debug ui
#[cfg(feature = "debug-ui")]
#[structopt(long)]
#[arg(long)]
pub debug: bool,
/// Join an existing session or start a new session
#[structopt(long)]
#[arg(long)]
pub join: bool,
#[cfg(feature = "ui")]
#[structopt(long)]
#[arg(long)]
pub headless: bool,
}
5 changes: 2 additions & 3 deletions crates/mizer/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![windows_subsystem = "windows"]
use std::sync::mpsc;

use structopt::StructOpt;
use clap::Parser;

use mizer::{build_runtime, Api, Flags};
use mizer_api::handlers::Handlers;
Expand Down Expand Up @@ -61,7 +60,7 @@ fn run_headless(flags: Flags) -> anyhow::Result<()> {

fn init() -> anyhow::Result<(Flags, LoggingGuard)> {
mizer_util::tracing::init();
let flags = Flags::from_args();
let flags = Flags::parse();
let guard = logger::init(&flags)?;
tracing::debug!("flags: {:?}", flags);
init_ffmpeg()?;
Expand Down

0 comments on commit d36ed0d

Please sign in to comment.