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;
|
|
|
|
|
2023-01-13 01:08:32 -05:00
|
|
|
#[derive(Debug, Default)]
|
|
|
|
pub struct Nologin;
|
2022-12-25 22:27:17 -05:00
|
|
|
|
|
|
|
impl Cmd for Nologin {
|
|
|
|
fn cli(&self) -> clap::Command {
|
2023-01-13 01:08:32 -05:00
|
|
|
Command::new("nologin")
|
2022-12-25 22:27:17 -05:00
|
|
|
.author("Nathan Fisher")
|
|
|
|
.about("Denies a user account login ability")
|
|
|
|
}
|
|
|
|
|
2023-02-04 08:54:27 -05:00
|
|
|
fn run(&self, _matches: &clap::ArgMatches) -> Result<(), Box<dyn std::error::Error>> {
|
2022-12-25 22:27:17 -05:00
|
|
|
eprintln!("I'm sorry, I can't let you do that, Dave");
|
|
|
|
process::exit(42);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn path(&self) -> Option<crate::Path> {
|
2023-01-13 01:08:32 -05:00
|
|
|
Some(crate::Path::Sbin)
|
2022-12-25 22:27:17 -05:00
|
|
|
}
|
|
|
|
}
|