forked from rojo-rbx/rojo
Rewrite Project, remove SourceProject (#274)
* Rewrite project file to have relative paths and drop SourceProject * Redo project error types * Tidy up and document Project type * Strip out init command
This commit is contained in:
committed by
GitHub
parent
47c7f63d75
commit
1f7f2b22e7
@@ -1,37 +1,17 @@
|
||||
use failure::Fail;
|
||||
|
||||
use crate::{
|
||||
cli::{InitCommand, InitKind},
|
||||
project::{Project, ProjectInitError},
|
||||
};
|
||||
use crate::{cli::InitCommand, project::ProjectError};
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
pub enum InitError {
|
||||
#[fail(display = "Project init error: {}", _0)]
|
||||
ProjectInitError(#[fail(cause)] ProjectInitError),
|
||||
ProjectError(#[fail(cause)] ProjectError),
|
||||
}
|
||||
|
||||
impl_from!(InitError {
|
||||
ProjectInitError => ProjectInitError,
|
||||
ProjectError => ProjectError,
|
||||
});
|
||||
|
||||
pub fn init(options: InitCommand) -> Result<(), InitError> {
|
||||
let (project_path, project_kind) = match options.kind {
|
||||
InitKind::Place => {
|
||||
let path = Project::init_place(&options.path)?;
|
||||
(path, "place")
|
||||
}
|
||||
InitKind::Model => {
|
||||
let path = Project::init_model(&options.path)?;
|
||||
(path, "model")
|
||||
}
|
||||
};
|
||||
|
||||
println!(
|
||||
"Created new {} project file at {}",
|
||||
project_kind,
|
||||
project_path.display()
|
||||
);
|
||||
|
||||
Ok(())
|
||||
pub fn init(_options: InitCommand) -> Result<(), InitError> {
|
||||
unimplemented!("init command");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user