Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use structopt::StructOpt;
- mod cli;
- mod tasks;
- use cli::{Action::*, CommandLineArgs};
- use tasks::Task;
- fn main() {
- // Get the command-line arguments.
- let CommandLineArgs { action, todo_file } = CommandLineArgs::from_args();
- // Unpack the journal file.
- let journal_file = todo_file.expect("Failed to find journal file");
- // Perform the action.
- match action {
- Add { text } => tasks::add_task(todo_file, Task::new(text)),
- List => tasks::list_tasks(todo_file),
- Done { position } => tasks::complete_task(todo_file, position),
- }
- .expect("Failed to perform action")
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement