Merge pull request #3906 from epage/complete

docs(complete): Make example consistent
This commit is contained in:
Ed Page 2022-07-11 15:36:39 -05:00 committed by GitHub
commit 7c0068e5b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,7 +22,7 @@
//! ## Example //! ## Example
//! //!
//! ```rust,no_run //! ```rust,no_run
//! use clap::{Command, AppSettings, Arg, ValueHint, value_parser}; //! use clap::{Command, Arg, ValueHint, value_parser};
//! use clap_complete::{generate, Generator, Shell}; //! use clap_complete::{generate, Generator, Shell};
//! use std::io; //! use std::io;
//! //!
@ -35,6 +35,7 @@
//! .arg( //! .arg(
//! Arg::new("generator") //! Arg::new("generator")
//! .long("generate") //! .long("generate")
//! .takes_value(true)
//! .value_parser(value_parser!(Shell)), //! .value_parser(value_parser!(Shell)),
//! ) //! )
//! } //! }
@ -46,7 +47,7 @@
//! fn main() { //! fn main() {
//! let matches = build_cli().get_matches(); //! let matches = build_cli().get_matches();
//! //!
//! if let Ok(generator) = matches.value_of_t::<Shell>("generator") { //! if let Some(generator) = matches.get_one::<Shell>("generator").copied() {
//! let mut cmd = build_cli(); //! let mut cmd = build_cli();
//! eprintln!("Generating completion file for {}...", generator); //! eprintln!("Generating completion file for {}...", generator);
//! print_completions(generator, &mut cmd); //! print_completions(generator, &mut cmd);