(value: &str)
| 100 | type Error = miette::Error; |
| 101 | |
| 102 | fn try_from(value: &str) -> Result<Self, Self::Error> { |
| 103 | if is_remote_zip_file(value) { |
| 104 | return Ok(Self::RemoteZip(value.into())); |
| 105 | } |
| 106 | |
| 107 | if let Some(repo) = match_git_http_url(value) { |
| 108 | return Ok(Self::RemoteRepo(repo)); |
| 109 | } |
| 110 | |
| 111 | if let Some(repo) = match_git_ssh_url(value) { |
| 112 | return Ok(Self::RemoteRepo(repo)); |
| 113 | } |
| 114 | |
| 115 | if !(value.starts_with("https://")) { |
| 116 | if let Some(path) = find_local_zip_file(value) { |
| 117 | return Ok(Self::LocalZip(path)); |
| 118 | } |
| 119 | |
| 120 | let path = find_local_directory(value)?; |
| 121 | return Ok(Self::LocalDir(path)); |
| 122 | } |
| 123 | |
| 124 | Err(miette::miette!( |
| 125 | "the given template option is not a valid Git URL or local directory: {value}" |
| 126 | )) |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | pub(crate) enum TemplateRoot { |
nothing calls this directly
no test coverage detected