From fb4917d050f9ec505d140ae0ea26916254fd9a15 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 14 Apr 2018 14:15:00 +0200 Subject: [PATCH] Remove feature to generate commandline completion scripts --- bin/core/imag/src/main.rs | 3 --- lib/core/libimagrt/src/runtime.rs | 28 +--------------------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/bin/core/imag/src/main.rs b/bin/core/imag/src/main.rs index a83cc234..a847af08 100644 --- a/bin/core/imag/src/main.rs +++ b/bin/core/imag/src/main.rs @@ -407,9 +407,6 @@ fn forward_commandline_arguments(m: &ArgMatches, scmd: &mut Vec) { 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); } diff --git a/lib/core/libimagrt/src/runtime.rs b/lib/core/libimagrt/src/runtime.rs index c0e8488f..a51fe8c5 100644 --- a/lib/core/libimagrt/src/runtime.rs +++ b/lib/core/libimagrt/src/runtime.rs @@ -111,27 +111,14 @@ impl<'a> Runtime<'a> { Runtime::_new(cli_app, matches, config) } - fn _new(mut cli_app: C, matches: ArgMatches<'a>, config: Option) + fn _new(cli_app: C, matches: ArgMatches<'a>, config: Option) -> Result, 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::().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