7 pub mod cmd_completions;
9 #[derive(clap::Parser, Debug)]
10 #[command(name = "bcachefs")]
12 #[command(subcommand)]
13 subcommands: Subcommands,
16 #[derive(Subcommand, Debug)]
19 Mount(cmd_mount::Cli),
20 Completions(cmd_completions::Cli),
27 std::ffi::CStr::from_ptr(concat!($lit, "\0").as_ptr() as *const std::os::raw::c_char)
29 .as_ptr() as *const std::os::raw::c_char
35 macro_rules! transform_c_args {
36 ($var:ident, $argc:expr, $argv:expr) => {
37 // TODO: `OsStr::from_bytes` only exists on *nix
38 use ::std::os::unix::ffi::OsStrExt;
39 let $var: Vec<_> = (0..$argc)
40 .map(|i| unsafe { ::std::ffi::CStr::from_ptr(*$argv.add(i as usize)) })
41 .map(|i| ::std::ffi::OsStr::from_bytes(i.to_bytes()))
47 struct ErrnoError(errno::Errno);
48 impl std::fmt::Display for ErrnoError {
49 fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
53 impl std::error::Error for ErrnoError {}