Add documentation.

This commit is contained in:
Olivia Brooks
2026-02-22 13:45:53 -05:00
parent 6ad82c3339
commit fee63a2d4b

View File

@@ -5,6 +5,11 @@ use cli::{CLI_ARGS, Command};
fn main() -> anyhow::Result<()> { fn main() -> anyhow::Result<()> {
// type_ is yet unused. // 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 { if let Command::New { project_name, .. } = &CLI_ARGS.command {
new(project_name.to_owned())?; new(project_name.to_owned())?;
} }
@@ -35,7 +40,10 @@ fn main() -> anyhow::Result<()> {
Ok(()) Ok(())
} }
/// Creates a new project directory and enters it.
fn new(project_name: String) -> anyhow::Result<()> { 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); let cwd = std::env::current_dir()?.join(project_name);
std::fs::create_dir(&cwd)?; std::fs::create_dir(&cwd)?;