main_ -> _cli

This commit is contained in:
🪞👃🪞 2024-10-06 02:30:59 +03:00
parent 9b8a14df0e
commit 323a8aeb5f
4 changed files with 15 additions and 15 deletions

View file

@ -0,0 +1,40 @@
//! Phrase editor.
include!("lib.rs");
pub fn main () -> Usually<()> { SequencerCli::parse().run() }
use tek_core::clap::{self, Parser};
#[derive(Debug, Parser)]
#[command(version, about, long_about = None)]
pub struct SequencerCli {
/// Name of JACK client
#[arg(short, long)] name: Option<String>,
/// Pulses per quarter note (sequencer resolution; default: 96)
#[arg(short, long)] ppq: Option<usize>,
/// Default phrase duration (in pulses; default: 4 * PPQ = 1 bar)
#[arg(short, long)] length: Option<usize>,
/// Whether to include a transport toolbar (default: true)
#[arg(short, long)] transport: Option<bool>
}
impl SequencerCli {
fn run (&self) -> Usually<()> {
let mut seq = Sequencer::new("");
if let Some(name) = self.name.as_ref() {
seq.name = Arc::new(RwLock::new(name.clone()));
}
if let Some(ppq) = self.ppq {
seq.ppq = ppq;
}
if let Some(length) = self.length {
// TODO FIXME WTF
//if let Some(phrase) = seq.phrase.as_mut() {
//phrase.write().unwrap().length = length;
//}
}
if self.transport == Some(true) {
seq.transport = Some(Arc::new(RwLock::new(TransportToolbar::new(None))));
}
Tui::run(Arc::new(RwLock::new(seq))).map(|_|())
}
}