about summary refs log tree commit diff
path: root/src/actions/create.rs
blob: f00e95d72bcac44d8495635e466b3d4fc546a371 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use std::fs;

use anyhow::Result;

use crate::{actions::update, files::Locations};

use super::ActionOptions;

pub fn create(command_options: ActionOptions) -> Result<()> {
    let locations = Locations::from(&command_options);

    if locations.ka_path.exists() {
        fs::remove_dir_all(locations.ka_path.as_path())?;
    }

    fs::create_dir(locations.ka_path)?;
    fs::create_dir(locations.ka_files_path)?;

    update(command_options)?;

    Ok(())
}