diff --git a/crates/raven/src/main.rs b/crates/raven/src/main.rs index ef2d7ee..3f815be 100644 --- a/crates/raven/src/main.rs +++ b/crates/raven/src/main.rs @@ -5,6 +5,11 @@ use cli::{CLI_ARGS, Command}; fn main() -> anyhow::Result<()> { // type_ is yet unused. + + // `raven new` requires special behaviour. + // This will call the "new" part of the command, + // changing the cwd, before calling WorkspaceHandler.init() + // on the actual workspace directory. if let Command::New { project_name, .. } = &CLI_ARGS.command { new(project_name.to_owned())?; } @@ -35,7 +40,10 @@ fn main() -> anyhow::Result<()> { Ok(()) } +/// Creates a new project directory and enters it. fn new(project_name: String) -> anyhow::Result<()> { + // Because this messes around with the CWD, this should live external to any + // instance of a `WorkspaceHandler`. let cwd = std::env::current_dir()?.join(project_name); std::fs::create_dir(&cwd)?;