Skip to content

Commit

Permalink
docs(complete): Polish API reference for dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Dec 27, 2023
1 parent 3630e58 commit 76beca4
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions clap_complete/src/dynamic/completer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub trait Completer {
completer: &str,
buf: &mut dyn std::io::Write,
) -> Result<(), std::io::Error>;
/// Complete the command
/// Complete the given command
fn write_complete(
&self,
cmd: &mut clap::Command,
Expand All @@ -26,7 +26,7 @@ pub trait Completer {
) -> Result<(), std::io::Error>;
}

/// Complete the command specified
/// Complete the given command
pub fn complete(
cmd: &mut clap::Command,
args: Vec<std::ffi::OsString>,
Expand Down
2 changes: 2 additions & 0 deletions clap_complete/src/dynamic/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//! Complete commands within shells
//!
//! For quick-start, see [`shells::CompleteCommand`]

mod completer;

Expand Down
2 changes: 1 addition & 1 deletion clap_complete/src/dynamic/shells/bash.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use unicode_xid::UnicodeXID as _;

/// Bash completions
/// Completion support for Bash
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct Bash;

Expand Down
2 changes: 1 addition & 1 deletion clap_complete/src/dynamic/shells/fish.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// Fish completions
/// Completion support for Fish
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct Fish;

Expand Down
4 changes: 4 additions & 0 deletions clap_complete/src/dynamic/shells/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ use std::io::Write as _;

use crate::dynamic::Completer as _;

/// A subcommand definition to `flatten` into your CLI
///
/// This provides a one-stop solution for integrating completions into your CLI
#[derive(clap::Subcommand)]
#[allow(missing_docs)]
#[derive(Clone, Debug)]
Expand All @@ -22,6 +25,7 @@ pub enum CompleteCommand {
Complete(CompleteArgs),
}

/// Generally used via [`CompleteCommand`]
#[derive(clap::Args)]
#[command(arg_required_else_help = true)]
#[command(group = clap::ArgGroup::new("complete").multiple(true).conflicts_with("register"))]
Expand Down
2 changes: 1 addition & 1 deletion clap_complete/src/dynamic/shells/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::str::FromStr;
use clap::builder::PossibleValue;
use clap::ValueEnum;

/// Shell with auto-generated completion script available.
/// Completion support for built-in shells
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[non_exhaustive]
pub enum Shell {
Expand Down

0 comments on commit 76beca4

Please sign in to comment.