upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/sub_commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/sub_commands')
-rw-r--r--src/sub_commands/init.rs33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/sub_commands/init.rs b/src/sub_commands/init.rs
index 56129a6..4b35d28 100644
--- a/src/sub_commands/init.rs
+++ b/src/sub_commands/init.rs
@@ -25,7 +25,7 @@ pub struct SubCommandArgs {
25 description: Option<String>, 25 description: Option<String>,
26 #[clap(long)] 26 #[clap(long)]
27 /// git server url users can clone from 27 /// git server url users can clone from
28 clone_url: Option<String>, 28 clone_url: Vec<String>,
29 #[clap(short, long, value_parser, num_args = 1..)] 29 #[clap(short, long, value_parser, num_args = 1..)]
30 /// homepage 30 /// homepage
31 web: Vec<String>, 31 web: Vec<String>,
@@ -129,19 +129,24 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
129 )?, 129 )?,
130 }; 130 };
131 131
132 let git_server = match &args.clone_url { 132 let git_server = if args.clone_url.is_empty() {
133 Some(t) => t.clone(), 133 Interactor::default()
134 None => Interactor::default().input( 134 .input(
135 PromptInputParms::default() 135 PromptInputParms::default()
136 .with_prompt("clone url") 136 .with_prompt("clone url")
137 .with_default(if let Some(repo_ref) = &repo_ref { 137 .with_default(if let Some(repo_ref) = &repo_ref {
138 repo_ref.git_server.clone() 138 repo_ref.git_server.clone().join(" ")
139 } else if let Ok(git_repo) = git_repo.get_origin_url() { 139 } else if let Ok(git_repo) = git_repo.get_origin_url() {
140 git_repo 140 git_repo
141 } else { 141 } else {
142 String::new() 142 String::new()
143 }), 143 }),
144 )?, 144 )?
145 .split(' ')
146 .map(std::string::ToString::to_string)
147 .collect()
148 } else {
149 args.clone_url.clone()
145 }; 150 };
146 151
147 let web: Vec<String> = if args.web.is_empty() { 152 let web: Vec<String> = if args.web.is_empty() {