From c723ebffe75c155cd2bfc5b18033f0a1b7c12cac Mon Sep 17 00:00:00 2001 From: Alexander Weiss Date: Fri, 22 Jul 2022 22:28:42 +0200 Subject: [PATCH] cat: don't require an id --- src/commands/cat.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands/cat.rs b/src/commands/cat.rs index e085ad3..a151bfd 100644 --- a/src/commands/cat.rs +++ b/src/commands/cat.rs @@ -21,14 +21,14 @@ pub(super) struct Opts { enum Command { TreeBlob(IdOpt), DataBlob(IdOpt), - Config(IdOpt), + Config, Index(IdOpt), Snapshot(IdOpt), /// display a tree within a snapshot Tree(TreeOpts), } -#[derive(Parser)] +#[derive(Default, Parser)] struct IdOpt { /// id to cat id: String, @@ -45,7 +45,7 @@ struct TreeOpts { pub(super) async fn execute(be: &impl DecryptReadBackend, opts: Opts) -> Result<()> { match opts.command { - Command::Config(opt) => cat_file(be, FileType::Config, opt).await, + Command::Config => cat_file(be, FileType::Config, IdOpt::default()).await, Command::Index(opt) => cat_file(be, FileType::Index, opt).await, Command::Snapshot(opt) => cat_file(be, FileType::Snapshot, opt).await, // special treatment for catingg blobs: read the index and use it to locate the blob