use clap::Parser;
use rsynko_media::{FormatPredicateAlg, FormatPredicateExt, FormatSelectionAlg, OutputTarget};
use rsynko_memory::{FormatSelection, MediaSyntax};
use std::path::PathBuf;
#[derive(Clone, Debug, Parser)]
#[command(name = "rsynko", version, about)]
pub(crate) struct Arguments {
#[arg(value_name = "SOURCE")]
pub(crate) sources: Vec<String>,
#[arg(short, long)]
pub(crate) output: Option<PathBuf>,
#[arg(long)]
pub(crate) no_tui: bool,
}
impl Arguments {
pub(crate) fn target(&self, index: usize) -> OutputTarget {
if self.sources.len() == 1 && index == 0 {
self.output
.clone()
.map_or(OutputTarget::Title, OutputTarget::Path)
} else {
OutputTarget::Title
}
}
}
pub(crate) fn progressive_selection() -> FormatSelection {
MediaSyntax.best_format(MediaSyntax.progressive_format())
}
pub(crate) fn any_selection() -> FormatSelection {
MediaSyntax.best_format(MediaSyntax.any_format())
}