File src/backend/build.rs changed (mode: 100644) (index c2d4f6c..7231f73) |
... |
... |
pub fn build_rec(config_file: PathBuf) -> Result<String, String> { |
37 |
37 |
let dep_tree = dep_tree.unwrap(); |
let dep_tree = dep_tree.unwrap(); |
38 |
38 |
|
|
39 |
39 |
for node in &dep_tree.depends_on { |
for node in &dep_tree.depends_on { |
40 |
|
println!("Building module '{}'..", &node.dep_name); |
|
|
40 |
|
println!("Building module '{}'..", &node.name); |
41 |
41 |
match build_rec(node.path.clone()) { |
match build_rec(node.path.clone()) { |
42 |
42 |
Ok(_) => {}, |
Ok(_) => {}, |
43 |
43 |
Err(e) => return Err(e) |
Err(e) => return Err(e) |
44 |
44 |
} |
} |
45 |
45 |
} |
} |
46 |
46 |
|
|
47 |
|
println!("Building current project '{}'..", &dep_tree.dep_name); |
|
|
47 |
|
println!("Building current project '{}'..", &dep_tree.name); |
48 |
48 |
match build(dep_tree.path) { |
match build(dep_tree.path) { |
49 |
49 |
Ok(result) => println!("{}", result), |
Ok(result) => println!("{}", result), |
50 |
50 |
Err(e) => return Err(e) |
Err(e) => return Err(e) |
File src/backend/delete.rs added (mode: 100644) (index 0000000..ca3192b) |
|
1 |
|
extern crate serde_json; |
|
2 |
|
|
|
3 |
|
use super::system::OS; |
|
4 |
|
use super::deptree::Node; |
|
5 |
|
use std::result::Result; |
|
6 |
|
use std::path::PathBuf; |
|
7 |
|
use std::io; |
|
8 |
|
|
|
9 |
|
pub fn delete(path: PathBuf) -> Result<String, String> { |
|
10 |
|
let module = match super::deptree::print(&OS::All, path) { |
|
11 |
|
Ok(node) => node, |
|
12 |
|
Err(e) => return Err(e) |
|
13 |
|
}; |
|
14 |
|
|
|
15 |
|
match dep_check(&module) { |
|
16 |
|
Ok(_) => {}, |
|
17 |
|
Err(e) => return Err(e) |
|
18 |
|
} |
|
19 |
|
|
|
20 |
|
Ok(module.name) |
|
21 |
|
} |
|
22 |
|
|
|
23 |
|
fn dep_check_rec(tree: &Node) -> Result<Vec<Node>, String> { |
|
24 |
|
let mut nodes: Vec<Node> = Vec::new(); |
|
25 |
|
|
|
26 |
|
match super::deptree::dependency_of(&OS::current(), tree) { |
|
27 |
|
Ok(deps) => { |
|
28 |
|
for dep in deps { |
|
29 |
|
println!("Module '{}' depends on '{}'.", &dep.name, tree.name); |
|
30 |
|
match dep_check_rec(&dep) { |
|
31 |
|
Ok(ref new_nodes) if new_nodes.is_empty() => nodes.push(dep.clone()), |
|
32 |
|
Ok(new_nodes) => nodes = new_nodes, |
|
33 |
|
Err(e) => return Err(e) |
|
34 |
|
} |
|
35 |
|
} |
|
36 |
|
}, |
|
37 |
|
Err(e) => return Err(e) |
|
38 |
|
} |
|
39 |
|
|
|
40 |
|
Ok(nodes) |
|
41 |
|
} |
|
42 |
|
|
|
43 |
|
fn dep_check(node: &Node) -> Result<(), String> { |
|
44 |
|
let mut input = String::new(); |
|
45 |
|
let mut config_path = PathBuf::new(); |
|
46 |
|
|
|
47 |
|
match dep_check_rec(node) { |
|
48 |
|
Ok(nodes) => { |
|
49 |
|
for dep in nodes { |
|
50 |
|
config_path = dep.path; |
|
51 |
|
} |
|
52 |
|
}, |
|
53 |
|
Err(e) => return Err(e) |
|
54 |
|
} |
|
55 |
|
|
|
56 |
|
println!("Continue [y/N]?"); |
|
57 |
|
|
|
58 |
|
match io::stdin().read_line(&mut input) { |
|
59 |
|
Ok(_) if input.as_str() == "y\n" => { |
|
60 |
|
}, |
|
61 |
|
Ok(_) => return Err(String::from("Aborted.")), |
|
62 |
|
Err(e) => return Err(e.to_string()) |
|
63 |
|
} |
|
64 |
|
|
|
65 |
|
if config_path == PathBuf::new() { |
|
66 |
|
return Ok(()); |
|
67 |
|
} |
|
68 |
|
|
|
69 |
|
rm_from_config(config_path, node.name.clone()) |
|
70 |
|
} |
|
71 |
|
|
|
72 |
|
fn rm_from_config(super_module: PathBuf, dep_name: String) -> Result<(), String> { |
|
73 |
|
let mut json = match super::config::get_json(super_module.clone()) { |
|
74 |
|
Ok(config) => config, |
|
75 |
|
Err(e) => return Err(e) |
|
76 |
|
}; |
|
77 |
|
|
|
78 |
|
match json["deps"]["linux"].as_object_mut() { |
|
79 |
|
Some(config) => { |
|
80 |
|
config.remove(&dep_name); |
|
81 |
|
println!("cfg: {:#?}", config); |
|
82 |
|
}, |
|
83 |
|
None => { println!("Linux: dep not found."); } |
|
84 |
|
} |
|
85 |
|
|
|
86 |
|
match json["deps"]["os-x"].as_object_mut() { |
|
87 |
|
Some(config) => { |
|
88 |
|
config.remove(&dep_name); |
|
89 |
|
println!("cfg: {:#?}", config); |
|
90 |
|
}, |
|
91 |
|
None => { println!("OS-X: dep not found."); } |
|
92 |
|
} |
|
93 |
|
|
|
94 |
|
match json["deps"]["windows"].as_object_mut() { |
|
95 |
|
Some(config) => { |
|
96 |
|
config.remove(&dep_name); |
|
97 |
|
println!("cfg: {:#?}", config); |
|
98 |
|
}, |
|
99 |
|
None => { println!("Windows: dep not found."); } |
|
100 |
|
} |
|
101 |
|
|
|
102 |
|
println!("{} config:\n{}", super_module.file_name().unwrap().to_str().unwrap(), json); |
|
103 |
|
//super::config::update(super_module, json) |
|
104 |
|
Ok(()) |
|
105 |
|
} |
File src/backend/dep.rs changed (mode: 100644) (index 7643de3..21b27f8) |
... |
... |
pub fn dep(config: serde_json::Value, os: &OS) -> Result<Vec<(String, String)>, |
43 |
43 |
let mut output: Vec<(String, String)> = Vec::new(); |
let mut output: Vec<(String, String)> = Vec::new(); |
44 |
44 |
|
|
45 |
45 |
match os { |
match os { |
46 |
|
OS::all => { |
|
47 |
|
match dep(config.clone(), &OS::linux) { |
|
|
46 |
|
OS::All => { |
|
47 |
|
match dep(config.clone(), &OS::Linux) { |
48 |
48 |
Ok(mut result) => { |
Ok(mut result) => { |
49 |
49 |
let mut r: Vec<(String,String)> = result; |
let mut r: Vec<(String,String)> = result; |
50 |
50 |
output.append(&mut r) |
output.append(&mut r) |
51 |
51 |
}, |
}, |
52 |
52 |
Err(e) => return Err(e) |
Err(e) => return Err(e) |
53 |
53 |
} |
} |
54 |
|
match dep(config.clone(), &OS::macos) { |
|
|
54 |
|
match dep(config.clone(), &OS::MacOs) { |
55 |
55 |
Ok(mut result) => { |
Ok(mut result) => { |
56 |
56 |
let mut r: Vec<(String,String)> = result; |
let mut r: Vec<(String,String)> = result; |
57 |
57 |
output.append(&mut r) |
output.append(&mut r) |
58 |
58 |
}, |
}, |
59 |
59 |
Err(e) => return Err(e) |
Err(e) => return Err(e) |
60 |
60 |
} |
} |
61 |
|
match dep(config.clone(), &OS::windows) { |
|
|
61 |
|
match dep(config.clone(), &OS::Windows) { |
62 |
62 |
Ok(mut result) => { |
Ok(mut result) => { |
63 |
63 |
let mut r: Vec<(String,String)> = result; |
let mut r: Vec<(String,String)> = result; |
64 |
64 |
output.append(&mut r) |
output.append(&mut r) |
|
... |
... |
pub fn dep(config: serde_json::Value, os: &OS) -> Result<Vec<(String, String)>, |
66 |
66 |
Err(e) => return Err(e) |
Err(e) => return Err(e) |
67 |
67 |
} |
} |
68 |
68 |
}, |
}, |
69 |
|
OS::linux => match config["deps"]["linux"] { |
|
|
69 |
|
OS::Linux => match config["deps"]["linux"] { |
70 |
70 |
json!(null) => return Ok(output), |
json!(null) => return Ok(output), |
71 |
71 |
ref deps => { |
ref deps => { |
72 |
72 |
match deps.as_object() { |
match deps.as_object() { |
|
... |
... |
pub fn dep(config: serde_json::Value, os: &OS) -> Result<Vec<(String, String)>, |
82 |
82 |
} |
} |
83 |
83 |
} |
} |
84 |
84 |
}, |
}, |
85 |
|
OS::macos => match config["deps"]["os-x"] { |
|
|
85 |
|
OS::MacOs => match config["deps"]["os-x"] { |
86 |
86 |
json!(null) => return Ok(output), |
json!(null) => return Ok(output), |
87 |
87 |
ref deps => { |
ref deps => { |
88 |
88 |
match deps.as_object() { |
match deps.as_object() { |
|
... |
... |
pub fn dep(config: serde_json::Value, os: &OS) -> Result<Vec<(String, String)>, |
98 |
98 |
} |
} |
99 |
99 |
} |
} |
100 |
100 |
}, |
}, |
101 |
|
OS::windows => match config["deps"]["windows"] { |
|
|
101 |
|
OS::Windows => match config["deps"]["windows"] { |
102 |
102 |
json!(null) => return Ok(output), |
json!(null) => return Ok(output), |
103 |
103 |
ref deps => { |
ref deps => { |
104 |
104 |
match deps.as_object() { |
match deps.as_object() { |
|
... |
... |
pub fn dep(config: serde_json::Value, os: &OS) -> Result<Vec<(String, String)>, |
122 |
122 |
pub fn check(config: serde_json::Value) -> Result<String, String> { |
pub fn check(config: serde_json::Value) -> Result<String, String> { |
123 |
123 |
println!("Checking dependencies.."); |
println!("Checking dependencies.."); |
124 |
124 |
|
|
125 |
|
match dep(config, &OS::linux) { |
|
|
125 |
|
match dep(config, &OS::Linux) { |
126 |
126 |
Ok(ref deps) if deps.is_empty() => return Ok(String::from("No dependencies found!")), |
Ok(ref deps) if deps.is_empty() => return Ok(String::from("No dependencies found!")), |
127 |
127 |
Ok(ref deps) => { |
Ok(ref deps) => { |
128 |
128 |
for dep in deps.iter() { |
for dep in deps.iter() { |
|
... |
... |
pub fn check(config: serde_json::Value) -> Result<String, String> { |
145 |
145 |
pub fn check(config: serde_json::Value) -> Result<String, String> { |
pub fn check(config: serde_json::Value) -> Result<String, String> { |
146 |
146 |
println!("Checking dependencies.."); |
println!("Checking dependencies.."); |
147 |
147 |
|
|
148 |
|
match dep(config, &OS::macos) { |
|
|
148 |
|
match dep(config, &OS::MacOs) { |
149 |
149 |
Ok(ref deps) if deps.is_empty() => return Ok(String::from("No dependencies found!")), |
Ok(ref deps) if deps.is_empty() => return Ok(String::from("No dependencies found!")), |
150 |
150 |
Ok(ref deps) => { |
Ok(ref deps) => { |
151 |
151 |
for dep in deps.iter() { |
for dep in deps.iter() { |
|
... |
... |
pub fn check(config: serde_json::Value) -> Result<String, String> { |
168 |
168 |
pub fn check(config: serde_json::Value) -> Result<String, String> { |
pub fn check(config: serde_json::Value) -> Result<String, String> { |
169 |
169 |
println!("Checking dependencies.."); |
println!("Checking dependencies.."); |
170 |
170 |
|
|
171 |
|
match dep(config, &OS::windows) { |
|
|
171 |
|
match dep(config, &OS::Windows) { |
172 |
172 |
Ok(ref deps) if deps.is_empty() => return Ok(String::from("No dependencies found!")), |
Ok(ref deps) if deps.is_empty() => return Ok(String::from("No dependencies found!")), |
173 |
173 |
Ok(ref deps) => { |
Ok(ref deps) => { |
174 |
174 |
for dep in deps.iter() { |
for dep in deps.iter() { |
|
... |
... |
pub fn check(config: serde_json::Value) -> Result<String, String> { |
188 |
188 |
} |
} |
189 |
189 |
|
|
190 |
190 |
fn dir_check(dependency: String, command: String) -> Result<String, String> { |
fn dir_check(dependency: String, command: String) -> Result<String, String> { |
191 |
|
let dir = super::filesystem::get_dep_root(); |
|
|
191 |
|
let dir = super::filesystem::get_current_dep_root(); |
192 |
192 |
|
|
193 |
193 |
match dir { |
match dir { |
194 |
194 |
Ok(mut dep_dir) => { |
Ok(mut dep_dir) => { |
File src/backend/deptree.rs changed (mode: 100644) (index d38bc6a..1c35108) |
... |
... |
extern crate serde_json; |
3 |
3 |
use super::system::OS; |
use super::system::OS; |
4 |
4 |
use std::result::Result; |
use std::result::Result; |
5 |
5 |
use std::path::PathBuf; |
use std::path::PathBuf; |
|
6 |
|
use std::cmp::PartialEq; |
|
7 |
|
use std::clone::Clone; |
6 |
8 |
use std::fmt; |
use std::fmt; |
7 |
9 |
|
|
|
10 |
|
#[derive(Clone)] |
8 |
11 |
pub struct Node { |
pub struct Node { |
9 |
|
pub dep_name: String, |
|
|
12 |
|
pub name: String, |
10 |
13 |
pub path: PathBuf, |
pub path: PathBuf, |
11 |
14 |
pub depends_on: Vec<Node> |
pub depends_on: Vec<Node> |
12 |
15 |
} |
} |
13 |
16 |
|
|
14 |
17 |
impl fmt::Display for Node { |
impl fmt::Display for Node { |
15 |
18 |
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
16 |
|
let mut dependency = self.clone(); |
|
17 |
|
let mut string = String::from(self.dep_name.clone()); |
|
|
19 |
|
let dependency = self.clone(); |
|
20 |
|
let mut string = String::from(self.name.clone()); |
18 |
21 |
|
|
19 |
22 |
string.push('\n'); |
string.push('\n'); |
20 |
23 |
|
|
|
... |
... |
impl fmt::Display for Node { |
36 |
39 |
} |
} |
37 |
40 |
} |
} |
38 |
41 |
|
|
|
42 |
|
impl PartialEq for Node { |
|
43 |
|
fn eq(&self, other: &Node) -> bool { |
|
44 |
|
self.name == other.name |
|
45 |
|
} |
|
46 |
|
} |
|
47 |
|
|
39 |
48 |
pub fn print(os: &OS, path: PathBuf) -> Result<Node, String> { |
pub fn print(os: &OS, path: PathBuf) -> Result<Node, String> { |
40 |
49 |
let mut deps: Vec<String> = Vec::new(); |
let mut deps: Vec<String> = Vec::new(); |
41 |
50 |
let mut nodes: Vec<Node> = Vec::new(); |
let mut nodes: Vec<Node> = Vec::new(); |
|
... |
... |
pub fn print(os: &OS, path: PathBuf) -> Result<Node, String> { |
53 |
62 |
for dependency in deps { |
for dependency in deps { |
54 |
63 |
let node: Node; |
let node: Node; |
55 |
64 |
|
|
56 |
|
match super::filesystem::get_dep_root() { |
|
|
65 |
|
match super::filesystem::get_current_dep_root() { |
57 |
66 |
Ok(mut dir) => { |
Ok(mut dir) => { |
58 |
67 |
dir.push(dependency); |
dir.push(dependency); |
59 |
68 |
match print(&os, dir) { |
match print(&os, dir) { |
|
... |
... |
pub fn print(os: &OS, path: PathBuf) -> Result<Node, String> { |
68 |
77 |
} |
} |
69 |
78 |
|
|
70 |
79 |
let root = Node { |
let root = Node { |
71 |
|
dep_name: String::from(path.file_name().unwrap().to_str().unwrap()), |
|
|
80 |
|
name: String::from(path.file_name().unwrap().to_str().unwrap()), |
72 |
81 |
path: path, |
path: path, |
73 |
82 |
depends_on: nodes |
depends_on: nodes |
74 |
83 |
}; |
}; |
75 |
84 |
|
|
76 |
85 |
Ok(root) |
Ok(root) |
77 |
86 |
} |
} |
|
87 |
|
|
|
88 |
|
pub fn dependency_of(os: &OS, dependency: &Node) -> Result<Vec<Node>, String> { |
|
89 |
|
match super::filesystem::get_project_root(dependency.path.clone()) { |
|
90 |
|
Some(path) => dependency_of_rec(os, dependency, path), |
|
91 |
|
None => Err(String::from("dependency_of: could not find project root.")) |
|
92 |
|
} |
|
93 |
|
} |
|
94 |
|
|
|
95 |
|
fn dependency_of_rec(os: &OS, dependency: &Node, root: PathBuf) -> Result<Vec<Node>, String> { |
|
96 |
|
let mut nodes: Vec<Node> = Vec::new(); |
|
97 |
|
|
|
98 |
|
match print(os, root) { |
|
99 |
|
Ok(tree) => { |
|
100 |
|
for node in &tree.depends_on { |
|
101 |
|
if node == dependency { |
|
102 |
|
nodes.push(tree.clone()); |
|
103 |
|
} |
|
104 |
|
nodes.append(&mut dependency_of_rec(os, dependency, node.path.clone()).unwrap()); |
|
105 |
|
} |
|
106 |
|
Ok(nodes) |
|
107 |
|
}, |
|
108 |
|
Err(e) => Err(e) |
|
109 |
|
} |
|
110 |
|
} |
File src/backend/filesystem.rs changed (mode: 100644) (index fd33d13..e7d35ba) |
... |
... |
fn get_root (mut path: path::PathBuf) -> Option<path::PathBuf> { |
16 |
16 |
} |
} |
17 |
17 |
} |
} |
18 |
18 |
|
|
19 |
|
pub fn get_module_root() -> Option<path::PathBuf> { |
|
20 |
|
get_root(env::current_dir().unwrap()) |
|
|
19 |
|
pub fn get_current_module_root() -> Option<path::PathBuf> { |
|
20 |
|
get_module_root(env::current_dir().unwrap()) |
21 |
21 |
} |
} |
22 |
22 |
|
|
23 |
|
pub fn get_project_root() -> Option<path::PathBuf> { |
|
24 |
|
let mut path = get_root(env::current_dir().unwrap()); |
|
|
23 |
|
pub fn get_module_root(from_dir: path::PathBuf) -> Option<path::PathBuf> { |
|
24 |
|
get_root(from_dir) |
|
25 |
|
} |
|
26 |
|
|
|
27 |
|
pub fn get_current_project_root() -> Option<path::PathBuf> { |
|
28 |
|
get_project_root(env::current_dir().unwrap()) |
|
29 |
|
} |
|
30 |
|
|
|
31 |
|
pub fn get_project_root(from_dir: path::PathBuf) -> Option<path::PathBuf> { |
|
32 |
|
let mut path = get_root(from_dir); |
25 |
33 |
let mut parentdir = path.clone(); |
let mut parentdir = path.clone(); |
26 |
34 |
|
|
27 |
35 |
loop { |
loop { |
|
... |
... |
pub fn get_project_root() -> Option<path::PathBuf> { |
38 |
46 |
} |
} |
39 |
47 |
} |
} |
40 |
48 |
|
|
41 |
|
pub fn get_dep_root() -> Result<path::PathBuf> { |
|
42 |
|
match get_project_root() { |
|
|
49 |
|
pub fn get_current_dep_root() -> Result<path::PathBuf> { |
|
50 |
|
get_dep_root(env::current_dir().unwrap()) |
|
51 |
|
} |
|
52 |
|
|
|
53 |
|
pub fn get_dep_root(from_dir: path::PathBuf) -> Result<path::PathBuf> { |
|
54 |
|
match get_project_root(from_dir) { |
43 |
55 |
Some(mut path) => { |
Some(mut path) => { |
44 |
56 |
path.push("dep"); |
path.push("dep"); |
45 |
57 |
if !path.is_dir() { |
if !path.is_dir() { |
File src/backend/project.rs changed (mode: 100644) (index 5333f3f..f86a134) |
... |
... |
pub fn init(args: &mut env::Args) { |
19 |
19 |
pub fn build(args: &mut env::Args) -> Result<String, String> { |
pub fn build(args: &mut env::Args) -> Result<String, String> { |
20 |
20 |
match args.next() { |
match args.next() { |
21 |
21 |
Some(ref module) if module.as_str() == "--module" => { |
Some(ref module) if module.as_str() == "--module" => { |
22 |
|
match super::filesystem::get_module_root() { |
|
|
22 |
|
match super::filesystem::get_current_module_root() { |
23 |
23 |
Some(dir) => super::build::build(dir), |
Some(dir) => super::build::build(dir), |
24 |
24 |
None => Err(String::from("not in a project (sub)directory.")) |
None => Err(String::from("not in a project (sub)directory.")) |
25 |
25 |
} |
} |
26 |
26 |
}, |
}, |
27 |
27 |
Some(_) | None => { |
Some(_) | None => { |
28 |
|
match super::filesystem::get_project_root() { |
|
|
28 |
|
match super::filesystem::get_current_project_root() { |
29 |
29 |
Some(dir) => super::build::build_rec(dir), |
Some(dir) => super::build::build_rec(dir), |
30 |
30 |
None => Err(String::from("not in a project (sub)directory.")) |
None => Err(String::from("not in a project (sub)directory.")) |
31 |
31 |
} |
} |
|
... |
... |
pub fn exe(args: &mut env::Args) -> Result<String, String> { |
37 |
37 |
let output_dir; |
let output_dir; |
38 |
38 |
let mut args = String::new(); |
let mut args = String::new(); |
39 |
39 |
|
|
40 |
|
match super::filesystem::get_project_root() { |
|
|
40 |
|
match super::filesystem::get_current_project_root() { |
41 |
41 |
Some(dir) => output_dir = dir, |
Some(dir) => output_dir = dir, |
42 |
42 |
None => return Err(String::from("not in a project (sub)directory.")) |
None => return Err(String::from("not in a project (sub)directory.")) |
43 |
43 |
} |
} |
|
... |
... |
pub fn run(args: &mut env::Args) -> Result<String, String> { |
94 |
94 |
exe(args) |
exe(args) |
95 |
95 |
} |
} |
96 |
96 |
|
|
|
97 |
|
pub fn delete(path: &mut env::Args) -> Result<String, String> { |
|
98 |
|
let path = match path.next() { |
|
99 |
|
Some(arg) => arg, |
|
100 |
|
None => return Err(String::from("Missing path as argument.")) |
|
101 |
|
}; |
|
102 |
|
|
|
103 |
|
match env::current_dir() { |
|
104 |
|
Ok(mut dir) => { |
|
105 |
|
dir.push(path); |
|
106 |
|
super::delete::delete(dir) |
|
107 |
|
}, |
|
108 |
|
Err(e) => Err(e.to_string()) |
|
109 |
|
} |
|
110 |
|
} |
|
111 |
|
|
97 |
112 |
pub fn dep_tree(args: &mut env::Args) -> Result<deptree::Node, String> { |
pub fn dep_tree(args: &mut env::Args) -> Result<deptree::Node, String> { |
98 |
|
let path = match super::filesystem::get_module_root() { |
|
|
113 |
|
let path = match super::filesystem::get_current_module_root() { |
99 |
114 |
Some(p) => p, |
Some(p) => p, |
100 |
115 |
None => return Err(String::from("Not in a project/dependency directory.")) |
None => return Err(String::from("Not in a project/dependency directory.")) |
101 |
116 |
}; |
}; |
102 |
117 |
|
|
103 |
118 |
match args.next() { |
match args.next() { |
104 |
|
Some(ref os) if os.as_str() == "linux" => deptree::print(&super::system::OS::linux, path), |
|
105 |
|
Some(ref os) if os.as_str() == "os-x" => deptree::print(&super::system::OS::macos, path), |
|
106 |
|
Some(ref os) if os.as_str() == "windows" => deptree::print(&super::system::OS::windows, path), |
|
107 |
|
Some(ref os) if os.as_str() == "all" => deptree::print(&super::system::OS::all, path), |
|
|
119 |
|
Some(ref os) if os.as_str() == "linux" => deptree::print(&super::system::OS::Linux, path), |
|
120 |
|
Some(ref os) if os.as_str() == "os-x" => deptree::print(&super::system::OS::MacOs, path), |
|
121 |
|
Some(ref os) if os.as_str() == "windows" => deptree::print(&super::system::OS::Windows, path), |
|
122 |
|
Some(ref os) if os.as_str() == "all" => deptree::print(&super::system::OS::All, path), |
108 |
123 |
Some(_) => Err(String::from("dep-tree: OS not found. Possible inputs: 'all', 'linux', 'os-x', 'windows'")), |
Some(_) => Err(String::from("dep-tree: OS not found. Possible inputs: 'all', 'linux', 'os-x', 'windows'")), |
109 |
124 |
None => deptree::print(&super::system::OS::current(), path) |
None => deptree::print(&super::system::OS::current(), path) |
110 |
125 |
} |
} |
|
... |
... |
pub fn help() { |
123 |
138 |
println!("run [ARGUMENTS]\t\t\t Build and run current project with ARGUMENTS to run project with."); |
println!("run [ARGUMENTS]\t\t\t Build and run current project with ARGUMENTS to run project with."); |
124 |
139 |
println!("exe [ARGUMENTS]\t\t\t Run current project with ARGUMENTS. The project won't be built."); |
println!("exe [ARGUMENTS]\t\t\t Run current project with ARGUMENTS. The project won't be built."); |
125 |
140 |
println!("add NAME COMMAND [ARGUMENTS]\t Add dependency with NAME to module and is built through COMMAND with ARGUMENTS."); |
println!("add NAME COMMAND [ARGUMENTS]\t Add dependency with NAME to module and is built through COMMAND with ARGUMENTS."); |
|
141 |
|
println!("delete PATH\t\t\t Delete a dependency in PATH."); |
126 |
142 |
println!("dep-tree [all|linux|os-x|windows] Print a tree of all dependencies used (indirectly) by a project for specified OS. Defaults to 'all'."); |
println!("dep-tree [all|linux|os-x|windows] Print a tree of all dependencies used (indirectly) by a project for specified OS. Defaults to 'all'."); |
127 |
143 |
} |
} |
File src/main.rs changed (mode: 100644) (index b4b1b95..41d8985) |
... |
... |
mod backend; |
5 |
5 |
use std::env; |
use std::env; |
6 |
6 |
|
|
7 |
7 |
fn main() { |
fn main() { |
8 |
|
match backend::filesystem::get_project_root() { |
|
|
8 |
|
match backend::filesystem::get_current_project_root() { |
9 |
9 |
Some(_) => println!("You are in a project."), |
Some(_) => println!("You are in a project."), |
10 |
10 |
None => println!("You are not in a project.") |
None => println!("You are not in a project.") |
11 |
11 |
} |
} |
|
... |
... |
fn parse() { |
50 |
50 |
Err(e) => println!("Could not add dependency: {}", e) |
Err(e) => println!("Could not add dependency: {}", e) |
51 |
51 |
} |
} |
52 |
52 |
} |
} |
|
53 |
|
else if &argument == "delete" { |
|
54 |
|
match backend::project::delete(&mut argv) { |
|
55 |
|
Ok(module) => println!("Module '{}' deleted.", module), |
|
56 |
|
Err(e) => println!("Deleting module failed: {}", e) |
|
57 |
|
} |
|
58 |
|
} |
53 |
59 |
else if &argument == "dep-tree" { |
else if &argument == "dep-tree" { |
54 |
60 |
match backend::project::dep_tree(&mut argv) { |
match backend::project::dep_tree(&mut argv) { |
55 |
61 |
Ok(tree) => println!("{}", tree), |
Ok(tree) => println!("{}", tree), |