use clap::ArgMatches;
use ffsend_api::url::Url;
use super::Matcher;
use crate::cmd::arg::{ArgOwner, ArgUrl, CmdArgOption};
pub struct DeleteMatcher<'a> {
matches: &'a ArgMatches<'a>,
}
impl<'a: 'b, 'b> DeleteMatcher<'a> {
pub fn url(&'a self) -> Url {
ArgUrl::value(self.matches)
}
pub fn owner(&'a self) -> Option<String> {
ArgOwner::value(self.matches).map(|token| token.to_owned())
}
}
impl<'a> Matcher<'a> for DeleteMatcher<'a> {
fn with(matches: &'a ArgMatches) -> Option<Self> {
matches
.subcommand_matches("delete")
.map(|matches| DeleteMatcher { matches })
}
}