Skip to content
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

Feature/repo add with optionals #15

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

andreclaudino
Copy link

Add a funtion to allow repository add with the other command line parameters. Useful to add authenticated repositories

@nicholastmosher
Copy link
Contributor

Hi @andreclaudino, thanks for the PR! I'll read through this and leave some comments sometime in the next day :)

@@ -0,0 +1,116 @@
use std::process::Command;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this file should be called repo_add_args instead of _optionals. Seems like it'd be more consistent with the other filenames

Comment on lines +12 to +14
ca_file: Option<String>,
cert_file: Option<String>,
key_file: Option<String>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer using std::path::PathBuf for file values

Comment on lines +43 to +56
pub fn set_ca_file<S: Into<String>>(mut self, value: S) -> Self {
self.ca_file = Some(value.into());
self
}

pub fn set_cert_file<S: Into<String>>(mut self, value: S) -> Self {
self.cert_file = Some(value.into());
self
}

pub fn set_key_file<S: Into<String>>(mut self, value: S) -> Self {
self.key_file = Some(value.into());
self
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can use <P: Into<PathBuf>> instead

}
}

impl Into<Command> for RepoAddArg {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me realize, we should be using impl From<RepoAddArg> for Command. It is generally better to implement From than Into. We may want to change this for the other commands as well

@nicholastmosher
Copy link
Contributor

@andreclaudino can you minimize this PR to only semantic changes in the code? It is easier to review when there is not the extra diff noise of moving code from one file to another. I saw you opened another PR for just breaking lib.rs into multiple modules, but you're also doing some of that here. Would you mind moving all of the refactor-only changes to that PR?

@andreclaudino
Copy link
Author

@nicholastmosher, You can just ignore this PR for a while. Evaluate the other, if is ok, I can just open a new PR with the complements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants