docs: add example to doc comments

This commit is contained in:
nibon7 2022-11-01 12:03:30 +08:00
parent 2b6bfeff61
commit c9fe396789
No known key found for this signature in database
GPG key ID: 281CE465D8EEC03B

View file

@ -1,4 +1,19 @@
//! Generates [Nushell](https://github.com/nushell/nushell) completions for [`clap`](https://github.com/clap-rs/clap) based CLIs
//!
//! ## Example
//!
//! ```
//! use clap::Command;
//! use clap_complete::generate;
//! use clap_complete_nushell::Nushell;
//! use std::io;
//!
//! let mut cmd = Command::new("myapp")
//! .subcommand(Command::new("test").subcommand(Command::new("config")))
//! .subcommand(Command::new("hello"));
//!
//! generate(Nushell, &mut cmd, "myapp", &mut io::stdout());
//! ```
use clap::{
builder::{PossibleValue, StyledStr},