pub mod format;
pub mod youtube;
use anyhow::Result;
use clap::{Parser, Subcommand};
#[derive(Parser)]
pub struct TranscriptCommand {
#[command(subcommand)]
pub command: TranscriptSubcommands,
}
#[derive(Subcommand)]
pub enum TranscriptSubcommands {
Youtube(youtube::YoutubeCommand),
}
impl TranscriptCommand {
pub async fn execute(self) -> Result<()> {
match self.command {
TranscriptSubcommands::Youtube(cmd) => cmd.execute().await,
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn transcript_subcommands_youtube_variant() {
let cmd = TranscriptCommand {
command: TranscriptSubcommands::Youtube(youtube::YoutubeCommand {
command: youtube::YoutubeSubcommands::Info(youtube::info::InfoCommand {
url: "https://youtu.be/dQw4w9WgXcQ".to_string(),
output: youtube::info::InfoOutput::Table,
}),
}),
};
assert!(matches!(cmd.command, TranscriptSubcommands::Youtube(_)));
}
}