File src/backend/project.rs changed (mode: 100644) (index 8640ea4..c772de1) |
... |
... |
pub fn build() -> Result<String, String> { |
22 |
22 |
} |
} |
23 |
23 |
} |
} |
24 |
24 |
|
|
25 |
|
pub fn run(args: &mut env::Args) -> Result<String, String> { |
|
|
25 |
|
pub fn exe(args: &mut env::Args) -> Result<String, String> { |
26 |
26 |
let output_dir; |
let output_dir; |
27 |
27 |
let mut args = String::new(); |
let mut args = String::new(); |
28 |
28 |
|
|
29 |
|
println!("Building project.."); |
|
30 |
|
|
|
31 |
|
match build() { |
|
32 |
|
Ok(output) => println!("{}", output), |
|
33 |
|
Err(e) => return Err(e) |
|
34 |
|
} |
|
35 |
|
|
|
36 |
29 |
match super::filesystem::get_project_root() { |
match super::filesystem::get_project_root() { |
37 |
30 |
Some(dir) => output_dir = dir, |
Some(dir) => output_dir = dir, |
38 |
31 |
None => return Err(String::from("not in a project (sub)directory.")) |
None => return Err(String::from("not in a project (sub)directory.")) |
|
... |
... |
pub fn run(args: &mut env::Args) -> Result<String, String> { |
79 |
72 |
} |
} |
80 |
73 |
} |
} |
81 |
74 |
|
|
|
75 |
|
pub fn run(args: &mut env::Args) -> Result<String, String> { |
|
76 |
|
println!("Building project.."); |
|
77 |
|
|
|
78 |
|
match build() { |
|
79 |
|
Ok(output) => println!("{}", output), |
|
80 |
|
Err(e) => return Err(e) |
|
81 |
|
} |
|
82 |
|
|
|
83 |
|
exe(args) |
|
84 |
|
} |
|
85 |
|
|
82 |
86 |
pub fn help() { |
pub fn help() { |
83 |
87 |
println!("Syntax:"); |
println!("Syntax:"); |
84 |
88 |
println!("$ beheer [FLAG] [COMMAND [ARGUMENTS]]"); |
println!("$ beheer [FLAG] [COMMAND [ARGUMENTS]]"); |
|
... |
... |
pub fn help() { |
90 |
94 |
println!("init [DIRECTORY]\tInitialize new project in specified directory. Defaults to current directory."); |
println!("init [DIRECTORY]\tInitialize new project in specified directory. Defaults to current directory."); |
91 |
95 |
println!("build\t\t\tBuild current project."); |
println!("build\t\t\tBuild current project."); |
92 |
96 |
println!("run [ARGUMENTS]\t\tBuild and run current project with ARGUMENTS to run project with."); |
println!("run [ARGUMENTS]\t\tBuild and run current project with ARGUMENTS to run project with."); |
93 |
|
println!("exe\t\t\tRun current project without building.", ); |
|
|
97 |
|
println!("exe [ARGUMENTS]\t\tRun current project with ARGUMENTS. The project won't be built."); |
94 |
98 |
} |
} |
File src/main.rs changed (mode: 100644) (index fa8f0d6..a1a3bd1) |
... |
... |
fn parse() { |
38 |
38 |
Err(e) => println!("Running project failed: {}", e) |
Err(e) => println!("Running project failed: {}", e) |
39 |
39 |
} |
} |
40 |
40 |
} |
} |
|
41 |
|
else if &argument == "exe" { |
|
42 |
|
match backend::project::exe(&mut argv) { |
|
43 |
|
Ok(_) => {}, |
|
44 |
|
Err(e) => println!("Running project failed: {}", e) |
|
45 |
|
} |
|
46 |
|
} |
41 |
47 |
}, |
}, |
42 |
48 |
None => backend::project::help() |
None => backend::project::help() |
43 |
49 |
} |
} |