upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-05-23 22:26:14 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2025-05-23 22:26:14 +0100
commit0f34bbdb452f287a03167abe24011bc35cc85c26 (patch)
tree26550c7f0e1ada0997178773e0c96dafc34203d9
parenta75a1441b7c1cec93ebc0cb796c21360abbc5573 (diff)
feat(init): use dir name as default repo name
if you haven't cloned an existing nostr repo
-rw-r--r--src/bin/ngit/sub_commands/init.rs7
1 files changed, 7 insertions, 0 deletions
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 @@
1use std::{ 1use std::{
2 collections::HashMap, 2 collections::HashMap,
3 env,
3 process::{Command, Stdio}, 4 process::{Command, Stdio},
4 str::FromStr, 5 str::FromStr,
5 thread, 6 thread,
@@ -111,6 +112,12 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
111 repo_ref.name.clone() 112 repo_ref.name.clone()
112 } else if let Some(coordinate) = &repo_coordinate { 113 } else if let Some(coordinate) = &repo_coordinate {
113 coordinate.identifier.clone() 114 coordinate.identifier.clone()
115 } else if let Ok(path) = env::current_dir() {
116 if let Some(current_dir_name) = path.file_name() {
117 current_dir_name.to_string_lossy().to_string()
118 } else {
119 String::new()
120 }
114 } else { 121 } else {
115 String::new() 122 String::new()
116 }), 123 }),