Skip to content

Instantly share code, notes, and snippets.

@rschulman
Last active September 11, 2017 23:25
Show Gist options
  • Save rschulman/f779e5299771b0bbc102edae9b60853c to your computer and use it in GitHub Desktop.
Save rschulman/f779e5299771b0bbc102edae9b60853c to your computer and use it in GitHub Desktop.
named!(command<&str, Command>, do_parse!(
todo() >>
c: todo_text() >>
d: deadline() >>
s: scheduled() >>
(Command::TodoCmd {
body: c.to_string(),
deadline: if d == "" { None } else { Some(d.to_string()) },
scheduled: if s == "" { None } else { Some(s.to_string()) }
})
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment