mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 06:44:16 +00:00
fix(complete)!: Clarify Completer is a ShellCompleter
This commit is contained in:
parent
16366d21f1
commit
38816ddb33
7 changed files with 8 additions and 8 deletions
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue