blob: 3a03d43af2a021bb68ec87997ed683775ee10a3d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
use snafu::{OptionExt, Snafu};
#[derive(Debug, Snafu)]
pub enum Error {
#[snafu(display("No command given"))]
CommandRequired,
}
pub fn parse(line: &str) -> Result<(String, Vec<String>), Error> {
// TODO
let mut tokens = line.split_whitespace().map(|s| s.to_string());
let cmd = tokens.next().context(CommandRequired)?;
Ok((cmd, tokens.collect()))
}
|