fix(complete)!: Clarify Completer is a ShellCompleter

This commit is contained in:
Ed Page 2024-08-09 14:03:02 -05:00
parent 16366d21f1
commit 38816ddb33
7 changed files with 8 additions and 8 deletions

View file

@ -4,7 +4,7 @@ use unicode_xid::UnicodeXID as _;
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct Bash;
impl crate::dynamic::shells::Completer for Bash {
impl crate::dynamic::shells::ShellCompleter for Bash {
fn file_name(&self, name: &str) -> String {
format!("{name}.bash")
}

View file

@ -2,7 +2,7 @@
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct Elvish;
impl crate::dynamic::shells::Completer for Elvish {
impl crate::dynamic::shells::ShellCompleter for Elvish {
fn file_name(&self, name: &str) -> String {
format!("{name}.elv")
}

View file

@ -2,7 +2,7 @@
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct Fish;
impl crate::dynamic::shells::Completer for Fish {
impl crate::dynamic::shells::ShellCompleter for Fish {
fn file_name(&self, name: &str) -> String {
format!("{name}.fish")
}

View file

@ -162,7 +162,7 @@ impl CompleteCommand {
}
/// Shell-specific completions
pub trait Completer {
pub trait ShellCompleter {
/// The recommended file name for the registration code
fn file_name(&self, name: &str) -> String;
/// Register for completions

View file

@ -57,7 +57,7 @@ impl ValueEnum for Shell {
}
impl Shell {
fn completer(&self) -> &dyn crate::dynamic::shells::Completer {
fn completer(&self) -> &dyn crate::dynamic::shells::ShellCompleter {
match self {
Self::Bash => &super::Bash,
Self::Fish => &super::Fish,
@ -67,7 +67,7 @@ impl Shell {
}
}
impl crate::dynamic::shells::Completer for Shell {
impl crate::dynamic::shells::ShellCompleter for Shell {
fn file_name(&self, name: &str) -> String {
self.completer().file_name(name)
}

View file

@ -2,7 +2,7 @@
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct Zsh;
impl crate::dynamic::shells::Completer for Zsh {
impl crate::dynamic::shells::ShellCompleter for Zsh {
fn file_name(&self, name: &str) -> String {
format!("{name}.zsh")
}

View file

@ -114,7 +114,7 @@ fn value_terminator() {
#[cfg(feature = "unstable-dynamic")]
#[test]
fn register_minimal() {
use clap_complete::dynamic::shells::Completer;
use clap_complete::dynamic::shells::ShellCompleter as _;
let name = "my-app";
let bin = name;