mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-25 12:52:47 -07:00
feat: init new git repo for new projects (#558)
This commit is contained in:
@@ -6,6 +6,8 @@ use std::env;
|
||||
use std::fs::{self, File, OpenOptions, create_dir};
|
||||
use std::io::{self, prelude::*};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use tracing::trace;
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
enum GithubFileType {
|
||||
@@ -156,6 +158,9 @@ pub fn create_new_project(
|
||||
|
||||
update_package_json_version(&folder_path).expect("Failed to update package.json version");
|
||||
update_cargo_toml_version(&folder_path).expect("Failed to update Cargo.toml version");
|
||||
|
||||
init_new_git_repo(&folder_path);
|
||||
|
||||
outro(folder);
|
||||
}
|
||||
|
||||
@@ -265,6 +270,16 @@ fn update_cargo_toml_version(folder_path: &Path) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn init_new_git_repo(folder_path: &Path) {
|
||||
if let Ok(output) = Command::new("git").arg("init").arg(folder_path).output() {
|
||||
if !output.status.success() {
|
||||
trace!("Failed to initialise a new git repo")
|
||||
}
|
||||
} else {
|
||||
trace!("Failed to initialise a new git repo")
|
||||
}
|
||||
}
|
||||
|
||||
fn outro(folder_name: String) {
|
||||
println!("Success! 🎉");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user