From d5c357e4564318577cf7e36d0f29b566f61dc825 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sat, 19 Sep 2020 15:04:18 +0200 Subject: Add the --progress option to the fill command The fill command starts a background operation on a Nitrokey Storage device that fills the SD card with random data. This patch adds a new option, --progress, to the fill command that checks if a fill operation is already running on the device and shows its progress. --- src/args.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/args.rs') diff --git a/src/args.rs b/src/args.rs index 4947825..8af38ca 100644 --- a/src/args.rs +++ b/src/args.rs @@ -80,7 +80,7 @@ Command! { /// Interacts with the device's encrypted volume Encrypted(EncryptedArgs) => |ctx, args: EncryptedArgs| args.subcmd.execute(ctx), /// Fills the SD card with random data - Fill => crate::commands::fill, + Fill(FillArgs) => |ctx, args: FillArgs| crate::commands::fill(ctx, args.attach), /// Interacts with the device's hidden volume Hidden(HiddenArgs) => |ctx, args: HiddenArgs| args.subcmd.execute(ctx), /// Lists the attached Nitrokey devices @@ -189,6 +189,14 @@ Command! {EncryptedCommand, [ Open => crate::commands::encrypted_open, ]} +#[derive(Debug, PartialEq, structopt::StructOpt)] +pub struct FillArgs { + /// Checks if a fill operation is already running and show its progress instead of starting a new + /// operation. + #[structopt(short, long)] + attach: bool, +} + #[derive(Debug, PartialEq, structopt::StructOpt)] pub struct HiddenArgs { #[structopt(subcommand)] -- cgit v1.2.1