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

@ -11,12 +11,12 @@ path = "src/lib.rs"
[[bin]]
name = "tek_sequencer"
path = "src/main_sequencer.rs"
path = "src/sequencer_cli.rs"
[[bin]]
name = "tek_arranger"
path = "src/main_arranger.rs"
path = "src/arranger_cli.rs"
[[bin]]
name = "tek_transport"
path = "src/main_transport.rs"
path = "src/transport_cli.rs"

View file

@ -1,6 +1,8 @@
include!("lib.rs");
use tek_core::clap::{self, Parser};
pub fn main () -> Usually<()> { ArrangerCli::parse().run() }
/// Parses CLI arguments to the `tek_arranger` invocation.
#[derive(Debug, Parser)]
#[command(version, about, long_about = None)]
@ -21,6 +23,7 @@ pub struct ArrangerCli {
#[arg(short, long, default_value_t = 8)]
scenes: usize,
}
impl ArrangerCli {
/// Run the arranger TUI from CLI arguments.
fn run (&self) -> Usually<()> {

View file

@ -1,8 +1,6 @@
//! Phrase editor.
include!("lib.rs");
pub fn main () -> Usually<()> {
Tui::run(Arc::new(RwLock::new(crate::Sequencer::from_args()))).map(|_|())
}
pub fn main () -> Usually<()> { SequencerCli::parse().run() }
use tek_core::clap::{self, Parser};
@ -19,25 +17,24 @@ pub struct SequencerCli {
#[arg(short, long)] transport: Option<bool>
}
impl Sequencer<Tui> {
pub fn from_args () -> Self {
let args = SequencerCli::parse();
let mut seq = Self::new("");
if let Some(name) = args.name {
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) = args.ppq {
if let Some(ppq) = self.ppq {
seq.ppq = ppq;
}
if let Some(length) = args.length {
if let Some(length) = self.length {
// TODO FIXME WTF
//if let Some(phrase) = seq.phrase.as_mut() {
//phrase.write().unwrap().length = length;
//}
}
if args.transport == Some(true) {
if self.transport == Some(true) {
seq.transport = Some(Arc::new(RwLock::new(TransportToolbar::new(None))));
}
seq
Tui::run(Arc::new(RwLock::new(seq))).map(|_|())
}
}