2022-12-25 23:50:37 -05:00
|
|
|
use super::Cmd;
|
2022-12-25 22:27:17 -05:00
|
|
|
use clap::Command;
|
|
|
|
use std::process;
|
|
|
|
|
2022-12-25 23:50:37 -05:00
|
|
|
#[derive(Debug)]
|
2022-12-25 22:27:17 -05:00
|
|
|
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)
|
|
|
|
.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
|
|
|
|
}
|
|
|
|
}
|