diff options
Diffstat (limited to 'src/sub_commands')
| -rw-r--r-- | src/sub_commands/init.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/sub_commands/init.rs b/src/sub_commands/init.rs index 4958536..5b7e03d 100644 --- a/src/sub_commands/init.rs +++ b/src/sub_commands/init.rs | |||
| @@ -13,7 +13,7 @@ use crate::{ | |||
| 13 | cli::Cli, | 13 | cli::Cli, |
| 14 | cli_interactor::{Interactor, InteractorPrompt, PromptInputParms}, | 14 | cli_interactor::{Interactor, InteractorPrompt, PromptInputParms}, |
| 15 | client::{fetching_with_report, get_repo_ref_from_cache, Connect}, | 15 | client::{fetching_with_report, get_repo_ref_from_cache, Connect}, |
| 16 | git::{Repo, RepoActions}, | 16 | git::{convert_clone_url_to_https, Repo, RepoActions}, |
| 17 | login, | 17 | login, |
| 18 | repo_ref::{ | 18 | repo_ref::{ |
| 19 | extract_pks, get_repo_config_from_yaml, save_repo_config_to_yaml, | 19 | extract_pks, get_repo_config_from_yaml, save_repo_config_to_yaml, |
| @@ -159,11 +159,16 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 159 | Interactor::default() | 159 | Interactor::default() |
| 160 | .input( | 160 | .input( |
| 161 | PromptInputParms::default() | 161 | PromptInputParms::default() |
| 162 | .with_prompt("clone url") | 162 | .with_prompt("clone url (for fetch)") |
| 163 | .with_default(if let Some(repo_ref) = &repo_ref { | 163 | .with_default(if let Some(repo_ref) = &repo_ref { |
| 164 | repo_ref.git_server.clone().join(" ") | 164 | repo_ref.git_server.clone().join(" ") |
| 165 | } else if let Ok(git_repo) = git_repo.get_origin_url() { | 165 | } else if let Ok(url) = git_repo.get_origin_url() { |
| 166 | git_repo | 166 | if let Ok(fetch_url) = convert_clone_url_to_https(&url) { |
| 167 | fetch_url | ||
| 168 | } else { | ||
| 169 | // local repo or custom protocol | ||
| 170 | url | ||
| 171 | } | ||
| 167 | } else { | 172 | } else { |
| 168 | String::new() | 173 | String::new() |
| 169 | }), | 174 | }), |