From 14d47b9b93e38b01008e9eadb918394fa7cf19f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=81scar=20M=2E=20Lage?= Date: Fri, 12 Nov 2021 23:53:55 +0100 Subject: [PATCH] Add: WIP project tasks --- src/cmd.rs | 15 +++++++++++++++ src/main.rs | 10 +++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/cmd.rs b/src/cmd.rs index 5331bd8..8384cf2 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -15,3 +15,18 @@ pub fn get_projects(config_file: &PathBuf) { let projects = String::from("we"); println!("{}", projects); } + +pub fn get_tasks(config_file: &PathBuf, project: i32) { + // Config + let mut default_config = config::Config::default(); + let config = default_config.parse(&config_file); + + // Call api + println!("Call API, Config: {:?}", config); + + // Return json result + let tasks = String::from("tasks"); + println!("{}", tasks); + + println!("{}", project); +} diff --git a/src/main.rs b/src/main.rs index ff9c148..72c5c19 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,11 +26,11 @@ fn main() { } ("tasks", Some(matches)) => { - let project = matches.value_of("project").unwrap_or(""); - println!("Tasks"); - if !project.is_empty() { - println!("Project: {}", project); - } + console::info("List of tasks"); + let project = matches.value_of("project") + .unwrap_or("0").trim().parse() + .expect("Type a number!"); + cmd::get_tasks(&config_file, project); } _ => console::error("Whut!!!"),