Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forc init project from template #836

Merged
merged 9 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions forc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description = "Fuel Orchestrator."
annotate-snippets = { version = "0.9", features = ["color"] }
ansi_term = "0.12"
anyhow = "1.0.41"
clap = { version = "3.1.2", features = ["env", "derive"] }
clap = { version = "3.1", features = ["env", "derive"] }
clap_complete = "3.1"
dirs = "3.0.2"
fuel-asm = "0.2"
Expand All @@ -39,9 +39,10 @@ term-table = "1.3"
termcolor = "1.1"
tokio = { version = "1.8.0", features = ["macros", "rt-multi-thread", "process"] }
toml = "0.5"
toml_edit = "0.13"
unicode-xid = "0.2.2"
ureq = "2.4"
url = "2"
ureq = { version = "2.4", features = ["json"] }
url = "2.2"
uwuify = { version = "^0.2", optional = true }
warp = "0.3"
whoami = "1.1"
Expand Down
17 changes: 13 additions & 4 deletions forc/src/cli/commands/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@ use crate::ops::forc_init;
use anyhow::Result;
use clap::Parser;

const TEMPLATE_HELP: &str = r#"Initialize a new project from a template.

Example Templates:
- counter"#;

/// Create a new Forc project.
#[derive(Debug, Parser)]
pub(crate) struct Command {
project_name: String,
pub struct Command {
/// Initialize a new project from a template
#[clap(short, long, help = TEMPLATE_HELP)]
pub template: Option<String>,
/// The name of your project
pub project_name: String,
}

pub(crate) fn exec(command: Command) -> Result<()> {
let project_name = command.project_name;
forc_init::init_new_project(project_name).map_err(|e| e)
forc_init::init(command)?;
Ok(())
}
2 changes: 1 addition & 1 deletion forc/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub use completions::Command as CompletionsCommand;
pub use deploy::Command as DeployCommand;
pub use explorer::Command as ExplorerCommand;
pub use format::Command as FormatCommand;
use init::Command as InitCommand;
pub use init::Command as InitCommand;
pub use json_abi::Command as JsonAbiCommand;
use lsp::Command as LspCommand;
use parse_bytecode::Command as ParseBytecodeCommand;
Expand Down
Loading