-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add cli option --force-url-http for URL display #1314
Conversation
I wonder if normalizing to HTTP should be the default behavior. 2 users can clone the exact same repo and get different stats based on their preferred clone strategy. I'm not sure if this is ideal. @o2sh thoughts? |
src/cli.rs
Outdated
/// Always display the repo url as http | ||
#[arg(long)] | ||
pub force_url_http: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Always display the repo url as http | |
#[arg(long)] | |
pub force_url_http: bool, | |
/// Display repository URL as HTTP | |
#[arg(long)] | |
pub http_url: bool, |
src/info/url.rs
Outdated
fn remove_token_from_url(url: &str) -> String { | ||
let pattern = Regex::new(r"(https?://)([^@]+@)").unwrap(); | ||
let replaced_url = pattern.replace(url, "$1").to_string(); | ||
replaced_url | ||
} | ||
|
||
fn create_http_url(url: &str) -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn create_http_url(url: &str) -> String { | |
fn create_http_url_from_ssh(url: &str) -> String { |
src/info/url.rs
Outdated
fn remove_token_from_url(url: &str) -> String { | ||
let pattern = Regex::new(r"(https?://)([^@]+@)").unwrap(); | ||
let replaced_url = pattern.replace(url, "$1").to_string(); | ||
replaced_url | ||
} | ||
|
||
fn create_http_url(url: &str) -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a unit test specifically for this method
I believe Onefetch should display the Git information verbatim unless asked otherwise. Knowing which protocol is used to sync with the remote can be important IMO. |
* rename create_http_url to create_http_url_from_ssh * add test for create_http_url_from_ssh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved 🎉
resolves #1313