mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 14:22:34 +00:00
Merge pull request #3906 from epage/complete
docs(complete): Make example consistent
This commit is contained in:
commit
7c0068e5b9
1 changed files with 3 additions and 2 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue