2023-01-04 14:26:44 -05:00
|
|
|
|
use super::Cmd;
|
|
|
|
|
use clap::{Arg, ArgAction, Command};
|
2022-12-20 12:05:21 -05:00
|
|
|
|
|
2023-01-04 14:26:44 -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")
|
2023-01-04 15:14:16 -05:00
|
|
|
|
.conflicts_with("fs-devno")
|
2023-01-04 14:26:44 -05:00
|
|
|
|
.action(ArgAction::SetTrue),
|
|
|
|
|
Arg::new("quiet")
|
|
|
|
|
.help("Be quiet - don’t 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
|
|
|
|
|
}
|
|
|
|
|
}
|