-
Notifications
You must be signed in to change notification settings - Fork 178
Expand file tree
/
Copy pathmod.rs
More file actions
49 lines (44 loc) · 1.51 KB
/
mod.rs
File metadata and controls
49 lines (44 loc) · 1.51 KB
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
39
40
41
42
43
44
45
46
47
48
49
pub mod changes;
mod contract;
mod notebook;
mod project;
use crate::types::RequirementConfig;
pub use changes::{Changes, DirectoryCreation, FileCreation, TOMLEdition};
use contract::GetChangesForNewContract;
use notebook::GetChangesForNewNotebook;
use project::GetChangesForNewProject;
use std::{collections::HashMap, path::PathBuf};
pub fn get_changes_for_new_project(project_path: String, project_name: String) -> Vec<Changes> {
let mut command = GetChangesForNewProject::new(project_path, project_name);
command.run()
}
pub fn get_changes_for_new_contract(
manifest_path: PathBuf,
contract_name: String,
source: Option<String>,
include_test: bool,
deps: Vec<String>,
) -> Vec<Changes> {
let mut command = GetChangesForNewContract::new(manifest_path, contract_name, source);
command.run(include_test, deps)
}
pub fn get_changes_for_new_link(
manifest_path: PathBuf,
contract_id: String,
_source: Option<String>,
) -> Vec<Changes> {
let change = TOMLEdition {
comment: format!("Adding {} as a requirement in Clarinet.toml", contract_id),
manifest_path,
contracts_to_add: HashMap::new(),
requirements_to_add: vec![RequirementConfig {
contract_id: contract_id.clone(),
}],
};
vec![Changes::EditTOML(change)]
}
#[allow(dead_code)]
pub fn get_changes_for_new_notebook(manifest_path: PathBuf, notebook_name: String) -> Vec<Changes> {
let command = GetChangesForNewNotebook::new(manifest_path, notebook_name);
command.run()
}