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
//!
//! ```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 std::io;
//!
@ -35,6 +35,7 @@
//! .arg(
//! Arg::new("generator")
//! .long("generate")
//! .takes_value(true)
//! .value_parser(value_parser!(Shell)),
//! )
//! }
@ -46,7 +47,7 @@
//! fn main() {
//! 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();
//! eprintln!("Generating completion file for {}...", generator);
//! print_completions(generator, &mut cmd);