You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Igloo/src/main.rs

181 lines
3.6 KiB
Rust

#[macro_use]
extern crate clap;
use clap::{Arg, App, ArgGroup};
use std::str::FromStr;
use std::process;
enum BuildTypes
{
Release,
Debug,
}
struct Igloo
{
debug_mode: bool,
release_mode: bool,
fresh_mode: bool,
version: String,
name: String,
author: String,
description: String,
}
4 years ago
fn main()
{
let mut _igloo: Igloo = Igloo
{
debug_mode: true,
release_mode: false,
fresh_mode: false,
version: "v".to_owned() + crate_version!(),
name: String::from("Igloo"),
author: crate_authors!().to_owned(),
description: crate_description!().to_owned(),
};
let matches = App::new(_igloo.name)
.version(&*_igloo.version)
.author(&*_igloo.author)
.about(&*_igloo.description)
.arg(Arg::with_name("VERSION")
.short('v')
.multiple(true)
.about("Sets the level of verbosity"))
.subcommand(App::new("new")
.about("Creates a new igloo project")
.arg(
Arg::new("NAME")
.required(true)
.about("The name of your new project")))
.subcommand(App::new("run")
.about("Builds project on target selected in config file")
.arg(Arg::new("RELEASE")
.short('R')
.long("release")
.about("builds in release mode"))
.arg(Arg::new("DEBUG")
.short('D')
.long("debug")
.about("builds in debug mode"))
.arg(Arg::new("FRESH")
.short('F')
.long("fresh")
.about("Clean project, then builds project")))
.subcommand(App::new("build")
.about("Builds project on target selected in config file")
.arg(Arg::new("RELEASE")
.short('R')
.long("release")
.about("builds in release mode"))
.arg(Arg::new("DEBUG")
.short('D')
.long("debug")
.about("builds in debug mode"))
.arg(Arg::new("FRESH")
.short('F')
.long("fresh")
.about("Clean project, then builds project")))
.subcommand(App::new("clean")
.about("Cleans project")
.version("0.0")
.arg(Arg::new("verbose")
.short('v')
.about("cleans project and prints extra info")))
.get_matches();
match matches.subcommand()
{
("new", Some(new_matches)) =>
{
println!("Creating new project named {}", new_matches.value_of("NAME").unwrap());
}
("run", Some(run_matches)) =>
{
if run_matches.is_present("FRESH")
{
println!("Building fresh project");
_igloo.fresh_mode = true;
}
if run_matches.is_present("RELEASE") && run_matches.is_present("DEBUG")
{
println!("Can't run in debug and release mode...");
process::exit(1);
}
else if run_matches.is_present("DEBUG")
{
_igloo.debug_mode = true;
}
else if run_matches.is_present("RELEASE")
{
_igloo.release_mode = true;
_igloo.debug_mode = false;
}
}
("build", Some(build_matches)) =>
{
if build_matches.is_present("FRESH")
{
println!("Building fresh project");
_igloo.fresh_mode = true;
}
if build_matches.is_present("RELEASE") && build_matches.is_present("DEBUG")
{
println!("Can't run in debug and release mode...");
process::exit(1);
}
else if build_matches.is_present("DEBUG")
{
_igloo.debug_mode = true;
}
else if build_matches.is_present("RELEASE")
{
_igloo.release_mode = true;
_igloo.debug_mode = false;
}
}
("", None) => println!("No subcommand was used"),
_ => unreachable!(),
}
}
fn igloo_run(igloo_inst: &Igloo)
{
}
fn igloo_build(igloo_inst: &Igloo)
{
4 years ago
}
fn igloo_clean(igloo_inst: &Igloo)
{
}
fn igloo_init(igloo_inst: &Igloo)
{
}
fn igloo_search(igloo_inst: &Igloo)
{
}
fn igloo_test(igloo_inst: &Igloo)
{
}
fn igloo_doc(igloo_inst: &Igloo)
{
4 years ago
}