From 0671ddadd8008bd686fa6bd05f73ca54d28c722e Mon Sep 17 00:00:00 2001 From: Thomas Bertschinger Date: Sat, 4 May 2024 23:07:04 -0400 Subject: add "bkey-type" option to list command Only bkeys of the specified type will be printed. Signed-off-by: Thomas Bertschinger --- src/commands/list.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/commands/list.rs b/src/commands/list.rs index 0ed6be05..2cb93962 100644 --- a/src/commands/list.rs +++ b/src/commands/list.rs @@ -21,7 +21,18 @@ fn list_keys(fs: &Fs, opt: Cli) -> anyhow::Result<()> { break; } + match opt.bkey_type { + Some(ty) => { + if k.k.type_ != ty as u8 { + iter.advance(); + continue; + } + } + _ => {} + }; + println!("{}", k.to_text(fs)); + iter.advance(); } @@ -97,6 +108,10 @@ pub struct Cli { #[arg(short, long, default_value_t=bcachefs::btree_id::BTREE_ID_extents)] btree: bcachefs::btree_id, + /// Bkey type to list + #[arg(short='k', long)] + bkey_type: Option, + /// Btree depth to descend to (0 == leaves) #[arg(short, long, default_value_t=0)] level: u32, -- cgit v1.2.3