1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use std::env;
use super::{Config, CliError, LalResult};
use core::manifest::*;
pub fn init(cfg: &Config, force: bool, env: &str) -> LalResult<()> {
cfg.get_container(env.into())?;
let pwd = env::current_dir()?;
let last_comp = pwd.components().last().unwrap();
let dirname = last_comp.as_os_str().to_str().unwrap();
let mpath = ManifestLocation::identify(&pwd);
if !force && mpath.is_ok() {
return Err(CliError::ManifestExists);
}
create_lal_subdir(&pwd)?;
Manifest::new(dirname, env, ManifestLocation::default().as_path(&pwd)).write()?;
if let Ok(ManifestLocation::RepoRoot) = mpath {
warn!("Created manifest in new location under .lal");
warn!("Please delete the old manifest - it will not be read anymore");
}
Ok(())
}