diff options
author | Thomas Bertschinger <tahbertschinger@gmail.com> | 2024-05-04 23:07:04 -0400 |
---|---|---|
committer | Thomas Bertschinger <tahbertschinger@gmail.com> | 2024-05-07 21:29:32 -0400 |
commit | 0671ddadd8008bd686fa6bd05f73ca54d28c722e (patch) | |
tree | 170862b7df4fcae2dcb66d234b4fd109d0970918 /src | |
parent | ba0c99ecd9858951549127d405455423c4e471e8 (diff) |
add "bkey-type" option to list command
Only bkeys of the specified type will be printed.
Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/list.rs | 15 |
1 files changed, 15 insertions, 0 deletions
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<bcachefs::bch_bkey_type>, + /// Btree depth to descend to (0 == leaves) #[arg(short, long, default_value_t=0)] level: u32, |