use clap::{
app_from_crate, crate_authors, crate_description, crate_name, crate_version, AppSettings, Arg,
ArgMatches,
};
pub(crate) fn init_command_line() -> ArgMatches<'static> {
let matches = app_from_crate!()
.setting(AppSettings::ArgRequiredElseHelp) .setting(AppSettings::AllowLeadingHyphen) .setting(AppSettings::TrailingVarArg) .arg(
Arg::with_name("command")
.short("c")
.long("command")
.value_name("command")
.help("Pass the command to execute")
.conflicts_with("shell")
.required_unless("shell")
.conflicts_with("edit")
.required_unless("edit")
.index(1) .multiple(true) .allow_hyphen_values(true) .takes_value(true),
)
.arg(
Arg::with_name("shell")
.short("s")
.long("shell")
.value_name("shell")
.help("Initialize a privilege shell")
.conflicts_with("command")
.required_unless("command")
.conflicts_with("edit")
.required_unless("edit")
.takes_value(false),
)
.arg(
Arg::with_name("user")
.short("u")
.long("user")
.value_name("user")
.help("The user you want to impersonate")
.takes_value(true),
)
.arg(
Arg::with_name("greeting")
.short("g")
.long("greeting")
.value_name("greeting")
.help("Greeting user")
.takes_value(false),
)
.arg(
Arg::with_name("debug")
.short("d")
.long("debug")
.value_name("debug")
.help("Log debug messages")
.takes_value(false),
)
.arg(
Arg::with_name("edit")
.short("e")
.long("edit")
.value_name("edit")
.help("Edit a document with the editor of user")
.conflicts_with("command")
.required_unless("command")
.conflicts_with("shell")
.required_unless("shell")
.takes_value(true),
)
.get_matches();
matches
}