Remove feature to generate commandline completion scripts

This commit is contained in:
Matthias Beyer 2018-04-14 14:15:00 +02:00 committed by Mario Krehl
parent 24b0cadb89
commit fb4917d050
2 changed files with 1 additions and 30 deletions

View file

@ -407,9 +407,6 @@ fn forward_commandline_arguments(m: &ArgMatches, scmd: &mut Vec<String>) {
push(Some("editor"),
Runtime::arg_editor_name(), m , scmd);
push(Some("generate-commandline-completion"),
Runtime::arg_generate_compl(), m , scmd);
push(None , Runtime::arg_logdest_name() , m , scmd);
}

View file

@ -111,27 +111,14 @@ impl<'a> Runtime<'a> {
Runtime::_new(cli_app, matches, config)
}
fn _new<C>(mut cli_app: C, matches: ArgMatches<'a>, config: Option<Value>)
fn _new<C>(cli_app: C, matches: ArgMatches<'a>, config: Option<Value>)
-> Result<Runtime<'a>, RuntimeError>
where C: Clone + CliSpec<'a> + InternalConfiguration
{
use std::io::stdout;
use clap::Shell;
if cli_app.enable_logging() {
Runtime::init_logger(&matches, config.as_ref())
}
match matches.value_of(Runtime::arg_generate_compl()) {
Some(shell) => {
debug!("Generating shell completion script, writing to stdout");
let shell = shell.parse::<Shell>().unwrap(); // clap has our back here.
let appname = String::from(cli_app.name());
cli_app.completions(appname, shell, &mut stdout());
},
_ => debug!("Not generating shell completion script"),
}
let rtp = get_rtp_match(&matches);
let storepath = matches.value_of(Runtime::arg_storepath_name())
@ -242,14 +229,6 @@ impl<'a> Runtime<'a> {
.required(false)
.takes_value(true))
.arg(Arg::with_name(Runtime::arg_generate_compl())
.long("generate-commandline-completion")
.help("Generate the commandline completion for bash or zsh or fish")
.required(false)
.takes_value(true)
.value_name("SHELL")
.possible_values(&["bash", "fish", "zsh"]))
.arg(Arg::with_name(Runtime::arg_logdest_name())
.long(Runtime::arg_logdest_name())
.help("Override the logging destinations from the configuration: values can be seperated by ',', a value of '-' marks the stderr output, everything else is expected to be a path")
@ -320,11 +299,6 @@ impl<'a> Runtime<'a> {
"editor"
}
/// Get the argument name for generating the completion
pub fn arg_generate_compl() -> &'static str {
"generate-completion"
}
/// Extract the Store object from the Runtime object, destroying the Runtime object
///
/// # Warning