real progress is new is now incomplete, but many of the lower level functions are working. i just need the project to get to the 'push' checkpoint and i can test everything

unstable
Penguin 3 years ago
parent 9945374437
commit 7633bdf878

@ -5,6 +5,9 @@ use crate::IglooType::*;
use crate::IglooStatus;
use crate::IglooStatus::*;
use crate::Igloo;
use crate::igloo_project::IglooProject;
pub fn igloo_subcommand(args: &ArgMatches) -> Result<IglooType, IglooStatus>
{
let mut _res_type: IglooType = IT_NULL;
@ -61,3 +64,41 @@ pub fn igloo_subcommand(args: &ArgMatches) -> Result<IglooType, IglooStatus>
Ok(_res_type)
}
pub fn ia_new(igloo: &Igloo, project_name: String, initial_target: String) -> IglooStatus
{
let mut ret: IglooStatus = IS_GOOD;
// is igloo project
if IglooProject::is_igloo_prj(&igloo.env.cwd)
{
println!("Calling igloo new from inside igloo project...");
ret = IS_BAD;
return ret
}
// check if project folder already exists
if std::path::Path::new(
&igloo.env.cwd.join(&project_name)).exists()
{
ret = IS_BAD;
return ret
}
let created_project = match IglooProject::from_new(igloo, project_name)
{
Ok(v) => v,
Err(e) =>
{
println!("{:?}", e);
panic!();
}
};
// Now populate
// created_project.populate()
ret
}

@ -56,4 +56,3 @@ impl IglooProjectManifest
}
}

@ -32,9 +32,9 @@ impl<'a> IglooProject<'a>
/// This means we do not yet have any project in storage
/// and we must generate those directories, files, and symlinks
/// and then populate the project in memory
pub fn from_new(igloo_in: &'a Igloo, project_name: String) -> IglooProject
pub fn from_new(igloo_in: &'a Igloo, project_name: String) -> Result<IglooProject, IglooStatus>
{
IglooProject
Ok(IglooProject
{
name: ich_new_get_project_name(igloo_in),
/// targets -- a vector of targets added for this project
@ -43,7 +43,7 @@ impl<'a> IglooProject<'a>
}
})
}
/// Used to populate an IglooProject from an existing project

@ -62,8 +62,6 @@ use IglooType::*;
pub struct Igloo
{
cli_info: IglooCliInfo,
// manifest containing all mcu information
master_target_manifest: Config,
env: IglooEnv,
}
@ -73,7 +71,6 @@ impl Igloo
{
Igloo
{
master_target_manifest: Config::new(),
cli_info: IglooCliInfo::new(),
env: IglooEnv::get_env(),
}
@ -83,16 +80,6 @@ impl Igloo
{
let mut res: IglooType = IT_NULL;
// let master_target_manifest = match igloo_manifest::get_master_target_manifest(self)
// {
// IS_GOOD => ,
// e =>
// {
// println!("{:?}", e);
// return Err(e)
// },
// }
// Assign instance type (new, run, push, etc)
igloo_action::igloo_subcommand(&self.cli_info.raw)
}
@ -100,8 +87,52 @@ impl Igloo
pub fn run(&self, inst_type: IglooType) -> IglooStatus
{
let mut res_err = IS_GOOD;
let mut prj: IglooProject;
match inst_type
{
IT_NEW =>
{
return igloo_action::ia_new(self,
igloo_cli::ich_new_get_project_name(self),
igloo_cli::ich_new_get_target_name(self))
}
IT_RUN =>
{
}
IT_PUSH =>
{
}
IT_PULL =>
{
}
IT_HELP =>
{
}
IT_BUILD =>
{
}
IT_ERASE =>
{
}
IT_INFO =>
{
}
IT_TARGET =>
{
}
IT_NULL =>
{
}
}
res_err
}
}

Loading…
Cancel
Save