Skip to main content

wapm_cli/commands/
init.rs

1use crate::init;
2use structopt::StructOpt;
3
4#[derive(StructOpt, Debug)]
5pub struct InitOpt {
6    /// Agree to all prompts. Useful for non-interactive uses
7    #[structopt(long = "force-yes", short = "y")]
8    force_yes: bool,
9    /// Initial project name to specify (`wapm init myproject`)
10    project_name: Option<String>,
11}
12
13pub fn init(opt: InitOpt) -> anyhow::Result<()> {
14    let current_directory = crate::config::Config::get_current_dir()?;
15    init::init(current_directory, opt.force_yes, opt.project_name)
16}
17
18#[cfg(feature = "integration_tests")]
19impl InitOpt {
20    pub fn new(force_yes: bool) -> Self {
21        InitOpt {
22            force_yes,
23            project_name: None,
24        }
25    }
26}