refactored for CLI!!!
This commit is contained in:
@@ -289,7 +289,7 @@ pub fn remove_project(projects: &mut Vec<Project>, config_path: &PathBuf){
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_projects(config_path: &PathBuf) -> Vec<Project>{
|
||||
pub fn get_projects(config_path: &PathBuf, show: bool) -> Vec<Project>{
|
||||
let mut mut_config_path = config_path.clone();
|
||||
mut_config_path.pop();
|
||||
mut_config_path.push("projects.conf");
|
||||
@@ -326,7 +326,9 @@ pub fn get_projects(config_path: &PathBuf) -> Vec<Project>{
|
||||
}
|
||||
let project_stage = settings[6].to_owned();
|
||||
let new_project = Project{customer: customer, project_name: project, files_folder: project_folder, notes_folder: notes_folder, active: active, id: first, boxname: boxname, stage: project_stage};
|
||||
println!("{} {} LOADED!", &new_project.customer, &new_project.project_name);
|
||||
if show{
|
||||
println!("{} {} LOADED!", &new_project.customer, &new_project.project_name);
|
||||
}
|
||||
projects.push(new_project);
|
||||
}
|
||||
}
|
||||
@@ -443,4 +445,11 @@ pub fn promote_project(projects: &mut Vec<Project>, config_path: &PathBuf, proje
|
||||
projects.clear();
|
||||
projects.append(&mut projects_to_save);
|
||||
save_projects(&projects_to_save, config_path);
|
||||
}
|
||||
|
||||
pub fn list_projects(projects: &Vec<Project>){
|
||||
println!("+++++++++++++++++++++");
|
||||
for project in projects{
|
||||
println!("++Customer: {}|Project name: {}|Stage: {}++",project.customer ,project.project_name, project.stage)}
|
||||
println!("++++++++++++++++++++")
|
||||
}
|
||||
Reference in New Issue
Block a user