diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-02-26 21:38:12 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-02-27 21:45:42 -0500 |
commit | e0e06d95f899e5e83d66e94600928156a5eb3a4b (patch) | |
tree | 5de00419aeed9689125493ce6894ab90b5ea57a0 /rust-src/src/cmd_mount.rs | |
parent | 30cca2e94d0dfa8c3151daf1393f402d32bb9407 (diff) |
Rust: Start of cmd_list rewrite
This is a _very_ preliminary rewrite of the cmd_list tool in rust, which
is intended to be a testing ground for a safe interface in Rust to the
core btree interface. This adds rust wrappers for:
bch_fs: provides bch2_fs_open(), bch2_fs_stop
btree_trans: provides bch2_trans_init(), bch2_trans_exit()
btree_iter: provides peek, peek_and_restart, advance
bch_errcode: implements Display (wraps bch2_err_str())
bpos: implements Ord (wraps bpos_cmp())
bkey_s_c: implements Display (wraps bch2_bkey_val_to_text())
and other assorted types.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'rust-src/src/cmd_mount.rs')
-rw-r--r-- | rust-src/src/cmd_mount.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/rust-src/src/cmd_mount.rs b/rust-src/src/cmd_mount.rs index 4bbe5fe7..1251d0d7 100644 --- a/rust-src/src/cmd_mount.rs +++ b/rust-src/src/cmd_mount.rs @@ -125,14 +125,6 @@ fn get_devices_by_uuid(uuid: Uuid) -> anyhow::Result<Vec<(PathBuf, bch_sb_handle Ok(devs) } -fn stdout_isatty() -> &'static str { - if atty::is(Stream::Stdout) { - "true" - } else { - "false" - } -} - /// Mount a bcachefs filesystem by its UUID. #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] @@ -159,10 +151,11 @@ struct Cli { options: String, /// Force color on/off. Default: autodetect tty - #[arg(short, long, action = clap::ArgAction::Set, default_value=stdout_isatty())] + #[arg(short, long, action = clap::ArgAction::Set, default_value_t=atty::is(Stream::Stdout))] colorize: bool, - #[arg(short = 'v', long, action = clap::ArgAction::Count)] + /// Verbose mode + #[arg(short, long, action = clap::ArgAction::Count)] verbose: u8, } |