seek spits out correct error when used with no args

This commit is contained in:
cyqsimon
2022-01-04 12:35:31 +08:00
committed by Henrik Friedrichsen
parent 8a4208b943
commit ba36f98367

View File

@@ -396,6 +396,12 @@ pub fn parse(input: &str) -> Result<Vec<Command>, CommandParseError> {
Command::Focus(target.into()) Command::Focus(target.into())
} }
"seek" => { "seek" => {
if args.is_empty() {
Err(InsufficientArgs {
cmd: command.into(),
hint: Some("a duration".into()),
})?;
}
let arg = args.join(" "); let arg = args.join(" ");
let first_char = arg.chars().next(); let first_char = arg.chars().next();
let duration_raw = match first_char { let duration_raw = match first_char {