2023-11-10 15:13:03 +03:00
|
|
|
use clap::Subcommand;
|
|
|
|
|
2023-04-26 22:50:16 +03:00
|
|
|
pub mod logger;
|
2023-01-04 06:31:36 +03:00
|
|
|
pub mod cmd_mount;
|
2023-02-27 05:38:12 +03:00
|
|
|
pub mod cmd_list;
|
2023-11-10 15:13:03 +03:00
|
|
|
pub mod cmd_completions;
|
2024-01-27 06:23:53 +03:00
|
|
|
pub mod cmd_subvolume;
|
2023-11-10 15:13:03 +03:00
|
|
|
|
|
|
|
#[derive(clap::Parser, Debug)]
|
|
|
|
#[command(name = "bcachefs")]
|
|
|
|
pub struct Cli {
|
|
|
|
#[command(subcommand)]
|
|
|
|
subcommands: Subcommands,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subcommand, Debug)]
|
|
|
|
enum Subcommands {
|
|
|
|
List(cmd_list::Cli),
|
|
|
|
Mount(cmd_mount::Cli),
|
|
|
|
Completions(cmd_completions::Cli),
|
2024-01-27 06:23:53 +03:00
|
|
|
Subvolume(cmd_subvolume::Cli),
|
2023-11-10 15:13:03 +03:00
|
|
|
}
|
2023-01-04 06:31:36 +03:00
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! c_str {
|
|
|
|
($lit:expr) => {
|
|
|
|
unsafe {
|
|
|
|
std::ffi::CStr::from_ptr(concat!($lit, "\0").as_ptr() as *const std::os::raw::c_char)
|
|
|
|
.to_bytes_with_nul()
|
|
|
|
.as_ptr() as *const std::os::raw::c_char
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|