36 lines
794 B
Rust
36 lines
794 B
Rust
use clap::Command;
|
|
use std::process;
|
|
use super::Cmd;
|
|
|
|
pub struct Nologin {
|
|
name: &'static str,
|
|
path: Option<crate::Path>,
|
|
}
|
|
|
|
pub const NOLOGIN: Nologin = Nologin {
|
|
name: "nologin",
|
|
path: Some(crate::Path::Sbin),
|
|
};
|
|
|
|
impl Cmd for Nologin {
|
|
fn name(&self) -> &str {
|
|
self.name
|
|
}
|
|
|
|
fn cli(&self) -> clap::Command {
|
|
Command::new(self.name)
|
|
.version(env!("CARGO_PKG_VERSION"))
|
|
.author("Nathan Fisher")
|
|
.about("Denies a user account login ability")
|
|
}
|
|
|
|
fn run(&self, _matches: Option<&clap::ArgMatches>) -> Result<(), Box<dyn std::error::Error>> {
|
|
eprintln!("I'm sorry, I can't let you do that, Dave");
|
|
process::exit(42);
|
|
}
|
|
|
|
fn path(&self) -> Option<crate::Path> {
|
|
self.path
|
|
}
|
|
}
|