From 7a910239b415504eab750323fd8d52715905ee43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Lehmann?= Date: Fri, 2 Feb 2024 15:08:10 +0100 Subject: [PATCH] reorder command and options so that they are mostly in alphabetical order, except for the global options -h, -v and -q --- src/cli.rs | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 1de0b1e..3d72b21 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -19,12 +19,12 @@ pub struct Cli { #[derive(Subcommand, Debug)] pub enum Commands { - Keygen(KeygenArgs), - Pubkey(PubkeyArgs), + Decrypt(DecryptArgs), Edit(EditArgs), Encrypt(EncryptArgs), - Decrypt(DecryptArgs), Env(EnvArgs), + Keygen(KeygenArgs), + Pubkey(PubkeyArgs), } /// Generate a new age key @@ -84,6 +84,10 @@ pub struct PubkeyArgs { /// Only the modified values are encrypted, the other values are left unchanged. #[derive(Args, Debug)] pub struct EditArgs { + /// The editor command to use + #[clap(short, long, env = "EDITOR")] + pub editor: PathBuf, + /// Decrypt with the specified key /// /// Note that passing private keys as arguments or environment variables may expose them to other users @@ -124,10 +128,6 @@ pub struct EditArgs { )] pub recipient_files: Vec, - /// The editor command to use - #[clap(short, long, env = "EDITOR")] - pub editor: PathBuf, - /// The encrypted YAML file to edit #[arg()] pub file: PathBuf, @@ -145,6 +145,14 @@ pub struct EditArgs { /// and left unchanged. #[derive(Args, Debug)] pub struct EncryptArgs { + /// Encrypt in place + /// + /// The input file is overwritten with the encrypted data. + /// + /// The --output option is ignored if this option is used. + #[clap(short, long)] + pub in_place: bool, + /// Encrypt to the specified recipients /// /// May be repeated. @@ -164,14 +172,6 @@ pub struct EncryptArgs { )] pub recipient_files: Vec, - /// Encrypt in place - /// - /// The input file is overwritten with the encrypted data. - /// - /// The --output option is ignored if this option is used. - #[clap(short, long)] - pub in_place: bool, - /// The output path to the encrypted YAML file /// /// The encrypted YAML file is written to the standard output by default. @@ -188,6 +188,14 @@ pub struct EncryptArgs { /// Decrypt the values in a YAML file #[derive(Args, Debug)] pub struct DecryptArgs { + /// Decrypt in place + /// + /// The input file is overwritten with the encrypted data. + /// + /// The --output option is ignored if this option is used. + #[clap(short, long)] + pub in_place: bool, + /// Decrypt with the specified key /// /// Note that passing private keys as arguments or environment variables may expose them to other users @@ -209,14 +217,6 @@ pub struct DecryptArgs { )] pub key_files: Vec, - /// Decrypt in place - /// - /// The input file is overwritten with the encrypted data. - /// - /// The --output option is ignored if this option is used. - #[clap(short, long)] - pub in_place: bool, - /// The output path to the decrypted YAML file /// /// The decrypted YAML file is written to the standard output by default. @@ -235,6 +235,10 @@ pub struct DecryptArgs { /// Other more complex YAML structures are not supported. #[derive(Args, Debug)] pub struct EnvArgs { + /// Start with an empty environment + #[clap(short, long, default_value_t = false)] + pub ignore_environment: bool, + /// Decrypt with the specified key /// /// Note that passing private keys as arguments or environment variables may expose them to other users @@ -256,10 +260,6 @@ pub struct EnvArgs { )] pub key_files: Vec, - /// Start with an empty environment - #[clap(short, long, default_value_t = false)] - pub ignore_environment: bool, - /// The YAML file to decrypt #[arg()] pub file: PathBuf,