From 0038f3cd9a4fd9f76fb4272e3abb762c0212fd7b Mon Sep 17 00:00:00 2001 From: Megatank58 Date: Tue, 4 Oct 2022 10:36:32 +0000 Subject: [PATCH] fix(init): dir structure --- README.md | 8 ++------ src/init.rs | 11 +++++------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 24cd536..fe0d8e2 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,7 @@ setx PATH "C:\oxido;%PATH%" ### Linux ```bash -wget https://github.com/oxidite/oxup/releases/latest/download/oxup-linux.tar.gz -tar -xf oxup-linux.tar.gz -./oxup setup +wget https://github.com/oxidite/oxup/releases/latest/download/oxup-linux.tar.gz && tar -xf oxup-linux.tar.gz && ./oxup setup && rm -rf oxup-linux.tar.gz ``` #### Bash ```bash @@ -33,9 +31,7 @@ echo '. "$HOME/.oxido/env"' >> $HOME/.zshrc ### Macos ```bash -wget https://github.com/oxidite/oxup/releases/latest/download/oxup-darwin.zip -unzip oxup-darwin.zip -./oxup setup +wget https://github.com/oxidite/oxup/releases/latest/download/oxup-darwin.zip && unzip oxup-darwin.zip && ./oxup setup && rm -rf oxup-darwin.zip ``` #### Bash ```bash diff --git a/src/init.rs b/src/init.rs index d0f9032..77b8f08 100644 --- a/src/init.rs +++ b/src/init.rs @@ -1,4 +1,4 @@ -use std::fs::{create_dir, write}; +use std::fs::{create_dir_all, write}; use crate::success; @@ -12,12 +12,11 @@ pub fn init(name: String) { "[package] name = {name} version = 0.1.0 -" - ); +"); - create_dir("src").unwrap(); - write("src/main.ox", default_function).unwrap(); - write("Oxup.toml", metadata).unwrap(); + create_dir_all(format!("{name}/src")).unwrap(); + write(format!("{name}/src/main.ox"), default_function).unwrap(); + write(format!("{name}/Oxup.toml"), metadata).unwrap(); success![format!("Successfully initialised {name}!")] }