From ef785cbd12b2f384d0737fa216eb746f02134db1 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Tue, 29 Oct 2024 10:51:49 +0100 Subject: [PATCH] Make sq key subkey revoke's positional arguments named arguments. - `sq key subkey revoke`'s reason and message arguments are positional arguments. Change them to be named arguments. - See #318. --- NEWS | 3 +++ src/cli/key/subkey.rs | 12 ++++++++---- tests/integration/common.rs | 4 ++-- tests/integration/sq_key_subkey.rs | 10 +++++----- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index affad15d..5e21bc90 100644 --- a/NEWS +++ b/NEWS @@ -162,6 +162,9 @@ - Change `sq key revoke`'s reason and message arguments from positional arguments to named arguments, `--reason`, and `--message`, respectively. + - Change `sq key subkey revoke`'s reason and message arguments from + positional arguments to named arguments, `--reason`, and + `--message`, respectively. * Changes in 0.38.0 ** Notable changes diff --git a/src/cli/key/subkey.rs b/src/cli/key/subkey.rs index fe0d6cee..0c6f389b 100644 --- a/src/cli/key/subkey.rs +++ b/src/cli/key/subkey.rs @@ -625,8 +625,8 @@ Revoke Alice's signing subkey.", "sq", "key", "subkey", "revoke", "--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0", "--key=42020B87D51877E5AF8D272124F3955B0B8DECC8", - "retired", - "Subkey rotation.", + "--reason", "retired", + "--message", "Subkey rotation.", ], }), @@ -638,8 +638,8 @@ Revoke Alice's signing subkey and encryption subkeys.", "--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0", "--key=42020B87D51877E5AF8D272124F3955B0B8DECC8", "--key=74DCDEAF17D9B995679EB52BA6E65EA2C8497728", - "retired", - "Subkey rotation.", + "--reason", "retired", + "--message", "Subkey rotation.", ], }), ], @@ -690,7 +690,9 @@ pub struct RevokeCommand { pub keys: Vec, #[clap( + long, value_name = "REASON", + required = true, help = "The reason for the revocation", long_help = "\ The reason for the revocation. @@ -704,7 +706,9 @@ of the user ID.", pub reason: KeyReasonForRevocation, #[clap( + long, value_name = "MESSAGE", + required = true, help = "A short, explanatory text", long_help = "\ A short, explanatory text. diff --git a/tests/integration/common.rs b/tests/integration/common.rs index cffc32cf..8811a9ca 100644 --- a/tests/integration/common.rs +++ b/tests/integration/common.rs @@ -993,8 +993,8 @@ impl Sq { let mut cmd = self.command(); cmd.arg("key").arg("subkey").arg("revoke") - .arg(reason) - .arg(message); + .arg("--reason").arg(reason) + .arg("--message").arg(message); for key in key_handles { cmd.arg("--key").arg(key.to_string()); diff --git a/tests/integration/sq_key_subkey.rs b/tests/integration/sq_key_subkey.rs index 33c99d2a..cf947788 100644 --- a/tests/integration/sq_key_subkey.rs +++ b/tests/integration/sq_key_subkey.rs @@ -252,8 +252,8 @@ fn sq_key_subkey_revoke() -> Result<()> { "subkey", "revoke", "--key", &subkey_fingerprint.to_string(), - reason_str, - message, + "--reason", reason_str, + "--message", message, ]); if keystore { @@ -367,7 +367,7 @@ fn sq_key_subkey_revoke_multiple() -> Result<()> { cmd.args(["--key", &subkey.key().fingerprint().to_string(),]); } - cmd.args(["retired", "rotation"]); + cmd.args(["--reason", "retired", "--message", "rotation"]); sq.run(cmd, Some(true)); let revoked = sq.cert_export(cert.key_handle()); @@ -505,8 +505,8 @@ fn sq_key_subkey_revoke_thirdparty() -> Result<()> { "subkey", "revoke", "--key", &subkey_fingerprint.to_string(), - reason_str, - message, + "--reason", reason_str, + "--message", message, ]); if keystore {