From c9fe396789bc8ddf831f6ae371f206831ac5710b Mon Sep 17 00:00:00 2001 From: nibon7 Date: Tue, 1 Nov 2022 12:03:30 +0800 Subject: [PATCH] docs: add example to doc comments --- src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 55e38981..de77dbed 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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},