From 0f34bbdb452f287a03167abe24011bc35cc85c26 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 23 May 2025 22:26:14 +0100 Subject: feat(init): use dir name as default repo name if you haven't cloned an existing nostr repo --- src/bin/ngit/sub_commands/init.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/bin') diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs index 9479032..f348c0d 100644 --- a/src/bin/ngit/sub_commands/init.rs +++ b/src/bin/ngit/sub_commands/init.rs @@ -1,5 +1,6 @@ use std::{ collections::HashMap, + env, process::{Command, Stdio}, str::FromStr, thread, @@ -111,6 +112,12 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { repo_ref.name.clone() } else if let Some(coordinate) = &repo_coordinate { coordinate.identifier.clone() + } else if let Ok(path) = env::current_dir() { + if let Some(current_dir_name) = path.file_name() { + current_dir_name.to_string_lossy().to_string() + } else { + String::new() + } } else { String::new() }), -- cgit v1.2.3