shitbox/src/cmd/mountpoint/mod.rs

51 lines
1.5 KiB
Rust
Raw Normal View History

use super::Cmd;
use clap::{Arg, ArgAction, Command};
2022-12-20 12:05:21 -05:00
#[derive(Debug)]
pub struct Mountpoint {
name: &'static str,
path: Option<crate::Path>,
}
pub const MOUNTPOINT: Mountpoint = Mountpoint {
name: "mountpoint",
path: Some(crate::Path::Bin),
};
impl Cmd for Mountpoint {
fn name(&self) -> &str {
self.name
}
fn cli(&self) -> clap::Command {
Command::new(self.name)
.about("see if a directory or file is a mountpoint")
.author("Nathan Fisher")
.args([
Arg::new("fs-devno")
.help("Show the major/minor numbers of the device that is mounted on the given directory.")
.short('d')
.long("fs-devno")
.action(ArgAction::SetTrue),
Arg::new("devno")
.help("Show the major/minor numbers of the given blockdevice on standard output.")
.short('x')
.long("devno")
.action(ArgAction::SetTrue),
Arg::new("quiet")
.help("Be quiet - dont print anything.")
.short('q')
.long("quiet")
.action(ArgAction::SetTrue),
])
}
fn run(&self, matches: Option<&clap::ArgMatches>) -> Result<(), Box<dyn std::error::Error>> {
unimplemented!();
}
fn path(&self) -> Option<crate::Path> {
self.path
}
}