clap-utils: Allow nonce/offline args to be global

This commit is contained in:
Trent Nelson
2020-09-28 20:59:37 -06:00
committed by Trent Nelson
parent 36d55c0667
commit 972619edb4
5 changed files with 35 additions and 30 deletions

View File

@ -36,12 +36,15 @@ pub fn nonce_authority_arg<'a, 'b>() -> Arg<'a, 'b> {
}
pub trait NonceArgs {
fn nonce_args(self) -> Self;
fn nonce_args(self, global: bool) -> Self;
}
impl NonceArgs for App<'_, '_> {
fn nonce_args(self) -> Self {
self.arg(nonce_arg())
.arg(nonce_authority_arg().requires(NONCE_ARG.name))
fn nonce_args(self, global: bool) -> Self {
self.arg(nonce_arg().global(global)).arg(
nonce_authority_arg()
.requires(NONCE_ARG.name)
.global(global),
)
}
}