-
-
Notifications
You must be signed in to change notification settings - Fork 2
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 keygen command. #9
base: main
Are you sure you want to change the base?
Conversation
This reverts commit 643ab86. See: <#9 (comment)>
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.
Well done! It's not super pretty, but it's about what you can expect for so much IO. I'd love to see this tested before we merge this.
src/commands/keygen.rs
Outdated
public_key.algorithm().to_int(), | ||
public_key.key_tag() | ||
); | ||
// TODO: Adjust for how 'Env' mocks the current directory. |
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.
It's on main
so you could do this (and make all this testable)
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.
Ah yeah, I need to rebase now.
make_ksk: bool, | ||
|
||
/// Whether to create symlinks. | ||
#[arg(short, long, value_enum, num_args = 0..=1, require_equals = true, default_missing_value = "yes", default_value = "no")] |
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.
Could you make the short = 's'
and long = "symlink"
explicit?
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.
This needs a massive comment to explain the rest of the attributes you put on here as well.
algorithm = parse_os_with("algorithm (-a)", &parser.value()?, |s| { | ||
Ok(match s { | ||
"list" => { | ||
// TODO: Mock stdout and process exit? |
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.
This is possible after the notify branch is merged, where parse_ldns
takes Env
as well.
|
||
Arg::Short('r') => { | ||
// NOTE: '-r' can be repeated; we don't use it, so the order doesn't matter. | ||
let _ = parser.value()?; |
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.
Do we want to warn or error here? Sounds like something that could lead to unexpected behaviour.
impl From<Keygen> for Command { | ||
fn from(value: Keygen) -> Self { | ||
Self::Keygen(value) | ||
} | ||
} |
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.
I put all of these in commands/mod.rs
, though maybe you're right it should be here.
|
||
/// Create a symlink, overwriting if it already exists. | ||
#[cfg(unix)] | ||
fn fs_symlink_force(&self, target: impl AsRef<Path>, link: impl AsRef<Path>) -> Result<()> { |
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.
I'm not sure about adding higher-level API's than std
here.
WIP.