diff options
-rw-r--r-- | yt/src/cli.rs | 10 | ||||
-rw-r--r-- | yt/src/select/cmds/mod.rs | 8 |
2 files changed, 11 insertions, 7 deletions
diff --git a/yt/src/cli.rs b/yt/src/cli.rs index b110772..e95b93f 100644 --- a/yt/src/cli.rs +++ b/yt/src/cli.rs @@ -218,15 +218,15 @@ pub struct SharedSelectionCommandArgs { /// The short extractor hash pub hash: LazyExtractorHash, - pub title: String, + pub title: Option<String>, - pub date: OptionalNaiveDate, + pub date: Option<OptionalNaiveDate>, - pub publisher: OptionalPublisher, + pub publisher: Option<OptionalPublisher>, - pub duration: Duration, + pub duration: Option<Duration>, - pub url: Url, + pub url: Option<Url>, } #[derive(Clone, Debug, Copy)] pub struct OptionalNaiveDate { diff --git a/yt/src/select/cmds/mod.rs b/yt/src/select/cmds/mod.rs index f576241..105569b 100644 --- a/yt/src/select/cmds/mod.rs +++ b/yt/src/select/cmds/mod.rs @@ -18,7 +18,7 @@ use crate::{ }, }; -use anyhow::{Context, Result}; +use anyhow::{bail, Context, Result}; mod add; @@ -50,9 +50,13 @@ pub async fn handle_select_cmd( } SelectCommand::Url { shared } => { + let Some(url) = shared.url else { + bail!("You need to provide a url to `select url ..`") + }; + let mut firefox = std::process::Command::new("firefox"); firefox.args(["-P", "timesinks.youtube"]); - firefox.arg(shared.url.as_str()); + firefox.arg(url.as_str()); let _handle = firefox.spawn().context("Failed to run firefox")?; } SelectCommand::File { .. } => unreachable!("This should have been filtered out"), |