working on implementing run, rewriting IglooProject and IglooTarget so they make more sense. also implementing cli info helper functions instead of bulk pasting code everywhere

unstable
Penguin 3 years ago
parent 2afd7d3fd3
commit f74f64f7b4

@ -1,5 +1,6 @@
use clap::{App, Arg, ArgMatches};
use crate::Igloo;
use crate::IglooType;
use crate::IglooType::*;
use crate::IglooStatus;
@ -101,3 +102,28 @@ fn igloo_run_cli() -> clap::ArgMatches
.get_matches();
ret_app
}
/// Igloo CLI Helper functions
/// These functions take some raw cli input and give us some helpful values
/// Putting these here so I don't have to pollute other code with this
pub fn ich_new_get_project_name(igloo: &Igloo) -> String
{
return String::from(igloo
.cli_info
.raw
.subcommand()
.unwrap().1
.value_of("project_name")
.unwrap())
}
pub fn ich_new_get_target_name(igloo: &Igloo) -> String
{
return String::from(igloo
.cli_info
.raw
.subcommand()
.unwrap().1
.value_of("target")
.unwrap())
}

@ -1,9 +1,63 @@
pub struct IglooProject
use crate::Igloo;
use crate::igloo_cli::*;
use crate::IglooType;
use crate::IglooType::*;
use crate::IglooStatus;
use crate::IglooStatus::*;
use crate::igloo_target::IglooTarget;
pub struct IglooProject<'a>
{
igloo: &'a Igloo,
name: String,
targets: Vec<IglooTarget>,
}
impl<'a> IglooProject<'a>
{
/// Used to populate an IglooProject from scratch
/// 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
{
IglooProject
{
name: ich_new_get_project_name(igloo_in),
/// targets -- a vector of targets added for this project
targets: Vec::default(),
igloo: igloo_in,
}
}
impl IglooProject
/// Used to populate an IglooProject from an existing project
/// So this will be called when things like
/// igloo run, push, pull, erase, etc... are called
pub fn from_existing(igloo: &'a Igloo) -> IglooProject
{
IglooProject
{
name:
}
}
pub fn is_igloo_prj(path: &std::path::PathBuf) -> bool
{
if !path.join("igloo").exists()
{
return false
}
if !path.join("igloo.toml").exists()
{
return false
}
return true
}
}

@ -0,0 +1,20 @@
struct IglooTargetLinks
{
common: String,
mcu: String,
ld: String,
cfg: String,
}
pub struct IglooTarget
{
name: String,
links: IglooTargetLinks,
includes: Vec<String>,
scripts: Vec<String>,
}
impl IglooTarget
{
}
Loading…
Cancel
Save