-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
70 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use clap::Parser; | ||
|
||
#[derive(Parser, Debug)] | ||
pub struct ListCli { | ||
#[arg(long = "format-project", short = 'p', alias = "fmt-proj")] | ||
pub format_project: Option<String>, | ||
|
||
#[arg(long = "format-template", short = 't', alias = "fmt-temp")] | ||
pub format_template: Option<String>, | ||
|
||
#[arg(long = "format-directory", short = 'd', alias = "fmt-dir")] | ||
pub format_directory: Option<String>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use crate::{cli::list::ListCli, directories, helpers::format_name, projects, templates}; | ||
|
||
pub fn list_handler(args: ListCli) { | ||
let projects = projects::parse_project_config(); | ||
let templates = templates::parse_template_config(); | ||
let dirs = directories::parse_directory_config(); | ||
|
||
for i in projects { | ||
println!("{}", format_name(&args.format_project, &i.name)); | ||
} | ||
for i in templates.into_iter().filter(|x| !x.hidden.unwrap_or(false)) { | ||
println!("{}", format_name(&args.format_template, &i.name)); | ||
} | ||
|
||
for i in dirs { | ||
if let Some(name) = &i.name { | ||
println!("{}", format_name(&args.format_directory, name)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod directory; | ||
pub mod init; | ||
pub mod list; | ||
pub mod project; | ||
pub mod template; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters