File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -274,6 +274,23 @@ impl GitUrl {
274
274
}
275
275
276
276
/// Normalize input into form that can be used by [`Url::parse`](https://docs.rs/url/latest/url/struct.Url.html#method.parse)
277
+ ///
278
+ /// ```
279
+ /// use git_url_parse::GitUrl;
280
+ /// #[cfg(feature = "url")]
281
+ /// use url::Url;
282
+ ///
283
+ /// fn main() -> Result<(), git_url_parse::GitUrlParseError> {
284
+ /// let ssh_url = GitUrl::parse_to_url("[email protected] :tjtelan/git-url-parse-rs.git")?;
285
+ ///
286
+ /// assert_eq!(ssh_url.scheme(), "ssh");
287
+ /// assert_eq!(ssh_url.username(), "git");
288
+ /// assert_eq!(ssh_url.host_str(), Some("github.com"));
289
+ /// assert_eq!(ssh_url.path(), "/tjtelan/git-url-parse-rs.git");
290
+ /// Ok(())
291
+ /// }
292
+ /// ```
293
+ ///
277
294
#[ cfg( feature = "url" ) ]
278
295
pub fn parse_to_url ( input : & str ) -> Result < Url , GitUrlParseError > {
279
296
let git_url = Self :: parse_to_git_url ( input) ?;
You can’t perform that action at this time.
0 commit comments