Skip to content

Commit 23fb056

Browse files
authored
Merge pull request #5679 from epage/api
feat(complete): Make `Shells` more flexible
2 parents 97deaf4 + f969bec commit 23fb056

File tree

1 file changed

+6
-1
lines changed
  • clap_complete/src/dynamic/env

1 file changed

+6
-1
lines changed

clap_complete/src/dynamic/env/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ pub struct Shells<'s>(pub &'s [&'s dyn EnvCompleter]);
232232

233233
impl<'s> Shells<'s> {
234234
/// Select all of the built-in shells
235-
pub fn builtins() -> Self {
235+
pub const fn builtins() -> Self {
236236
Self(&[&Bash, &Elvish, &Fish, &Powershell, &Zsh])
237237
}
238238

@@ -245,6 +245,11 @@ impl<'s> Shells<'s> {
245245
pub fn names(&self) -> impl Iterator<Item = &'static str> + 's {
246246
self.0.iter().map(|c| c.name())
247247
}
248+
249+
/// Iterate over [`EnvCompleter`]s
250+
pub fn iter(&self) -> impl Iterator<Item = &dyn EnvCompleter> {
251+
self.0.iter().copied()
252+
}
248253
}
249254

250255
/// Shell-integration for completions

0 commit comments

Comments
 (0)