-
Notifications
You must be signed in to change notification settings - Fork 0
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
10 changed files
with
133 additions
and
70 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 |
---|---|---|
|
@@ -6,4 +6,5 @@ pub mod generate; | |
pub mod init; | ||
pub mod schema; | ||
pub mod test; | ||
mod utils; | ||
|
||
pub mod list_templates; |
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,33 @@ | ||
//! Module responsible for listing templates in cli. | ||
use crate::{ | ||
consts::ODRA_TEMPLATE_GH_RAW_REPO, | ||
project::OdraLocation, | ||
template::{TemplateGenerator, TemplateType}, | ||
}; | ||
|
||
/// ListTemplatesAction configuration. | ||
#[derive(Clone)] | ||
pub struct ListTemplatesAction {} | ||
|
||
impl ListTemplatesAction { | ||
pub fn list(odra_location: OdraLocation) { | ||
let templates = | ||
TemplateGenerator::new(ODRA_TEMPLATE_GH_RAW_REPO.to_string(), odra_location) | ||
.fetch_templates(); | ||
println!("Available contract templates:"); | ||
templates | ||
.iter() | ||
.filter(|template| template.template_type == TemplateType::Contract) | ||
.for_each(|template| { | ||
println!("{:<15}{}", template.name, template.description); | ||
}); | ||
println!("\nAvailable project templates:"); | ||
templates | ||
.iter() | ||
.filter(|template| template.template_type == TemplateType::Project) | ||
.for_each(|template| { | ||
println!("{:<15}{}", template.name, template.description); | ||
}); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -15,3 +15,4 @@ mod odra_toml; | |
mod paths; | ||
mod project; | ||
mod template; | ||
mod utils; |
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