Skip to content

Commit

Permalink
more consistent option names
Browse files Browse the repository at this point in the history
  • Loading branch information
glehmann committed Feb 2, 2024
1 parent 0a20e4d commit 3adb722
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
22 changes: 11 additions & 11 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ pub struct EditArgs {
pub key_files: Vec<PathBuf>,

/// Encrypt to the specified recipients
#[clap(short, long = "recipient", env = "YAGE_RECIPIENTS")]
#[clap(short, long = "recipient", env = "YAGE_RECIPIENT")]
pub recipients: Vec<String>,

/// Encrypt to recipients listed at PATH
#[clap(short = 'R', long = "recipient-path", env = "YAGE_RECIPIENTS_FILE")]
pub recipients_paths: Vec<PathBuf>,
#[clap(short = 'R', long = "recipient-file", env = "YAGE_RECIPIENT_FILE")]
pub recipient_files: Vec<PathBuf>,

/// The editor command to use
#[clap(short, long, env = "EDITOR")]
Expand All @@ -80,21 +80,21 @@ pub struct EditArgs {
#[derive(Args, Debug)]
pub struct EncryptArgs {
/// Encrypt to the specified recipients
#[clap(short, long = "recipient", env = "YAGE_RECIPIENTS")]
#[clap(short, long = "recipient", env = "YAGE_RECIPIENT")]
pub recipients: Vec<String>,

/// Encrypt to recipients listed at PATH
#[clap(
short = 'R',
long = "recipient-path",
long = "recipient-file",
name = "PATH",
env = "YAGE_RECIPIENTS_FILE"
env = "YAGE_RECIPIENT_FILE"
)]
pub recipients_paths: Vec<PathBuf>,
pub recipients_files: Vec<PathBuf>,

/// Encrypt in place
#[clap(short, long)]
pub inplace: bool,
pub in_place: bool,

/// The output path to the encrypted YAML file
#[clap(short, long, default_value = "-")]
Expand All @@ -118,7 +118,7 @@ pub struct DecryptArgs {

/// Decrypt in place
#[clap(short, long)]
pub inplace: bool,
pub in_place: bool,

/// The output path to the decrypted YAML file
#[clap(short, long, default_value = "-")]
Expand All @@ -133,7 +133,7 @@ pub struct DecryptArgs {
#[derive(Args, Debug)]
pub struct EnvArgs {
/// Decrypt with the specified key
#[clap(short, long, env = "YAGE_KEY")]
#[clap(short, long = "keyà ", env = "YAGE_KEY")]
pub keys: Vec<String>,

/// Decrypt with the key at PATH
Expand All @@ -149,7 +149,7 @@ pub struct EnvArgs {
pub file: PathBuf,

/// Command to run
#[arg(name = "COMMAND")]
#[arg()]
pub command: String,

/// Command arguments
Expand Down
2 changes: 1 addition & 1 deletion src/decrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub fn decrypt(args: &DecryptArgs) -> Result<()> {
debug!("loading yaml file: {:?}", args.file);
let input_data: sy::Value = sy::from_reader(stdin_or_file(&args.file)?)?;
let output_data = decrypt_yaml(&input_data, &identities)?;
let output = stdout_or_file(if args.inplace {
let output = stdout_or_file(if args.in_place {
&args.file
} else {
&args.output
Expand Down
2 changes: 1 addition & 1 deletion src/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::util::{decrypt_yaml, encrypt_yaml, load_identities, load_recipients};

pub fn edit(args: &EditArgs) -> Result<()> {
let identities = load_identities(&args.keys, &args.key_files)?;
let mut recipients = load_recipients(&args.recipients, &args.recipients_paths)?;
let mut recipients = load_recipients(&args.recipients, &args.recipient_files)?;
// add the identities to the recipients, so that the user can edit the file
for identity in &identities {
recipients.push(identity.to_public());
Expand Down
4 changes: 2 additions & 2 deletions src/encrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use crate::error::Result;
use crate::util::{encrypt_yaml, load_recipients, stdin_or_file, stdout_or_file};

pub fn encrypt(args: &EncryptArgs) -> Result<()> {
let recipients = load_recipients(&args.recipients, &args.recipients_paths)?;
let recipients = load_recipients(&args.recipients, &args.recipients_files)?;
debug!("loading yaml file: {:?}", args.file);
let input_data: sy::Value = sy::from_reader(stdin_or_file(&args.file)?)?;
let output_data = encrypt_yaml(&input_data, &recipients)?;
let output = stdout_or_file(if args.inplace {
let output = stdout_or_file(if args.in_place {
&args.file
} else {
&args.output
Expand Down

0 comments on commit 3adb722

Please sign in to comment.