Skip to content

Commit 8b3de18

Browse files
authored
Merge pull request #5685 from epage/engine
fix(complete)!: Rename dynamic to engine
2 parents 232af62 + b38538d commit 8b3de18

File tree

10 files changed

+186
-84
lines changed

10 files changed

+186
-84
lines changed

clap_complete/src/command/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ impl CompleteArgs {
216216
///
217217
/// This will generally be called by [`CompleteCommand`] or [`CompleteArgs`].
218218
///
219-
/// This handles adapting between the shell and [`completer`][crate::dynamic::complete()].
219+
/// This handles adapting between the shell and [`completer`][crate::engine::complete()].
220220
/// A `CommandCompleter` can choose how much of that lives within the registration script and or
221221
/// lives in [`CommandCompleter::write_complete`].
222222
pub trait CommandCompleter {
@@ -238,9 +238,9 @@ pub trait CommandCompleter {
238238
/// Complete the given command
239239
///
240240
/// Adapt information from arguments and [`CommandCompleter::write_registration`]-defined env
241-
/// variables to what is needed for [`completer`][crate::dynamic::complete()].
241+
/// variables to what is needed for [`completer`][crate::engine::complete()].
242242
///
243-
/// Write out the [`CompletionCandidate`][crate::dynamic::CompletionCandidate]s in a way the shell will understand.
243+
/// Write out the [`CompletionCandidate`][crate::engine::CompletionCandidate]s in a way the shell will understand.
244244
fn write_complete(
245245
&self,
246246
cmd: &mut clap::Command,

clap_complete/src/command/shells.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ fi
241241
.ok()
242242
.and_then(|i| i.parse().ok());
243243
let ifs: Option<String> = std::env::var("IFS").ok().and_then(|i| i.parse().ok());
244-
let completions = crate::dynamic::complete(cmd, args, index, current_dir)?;
244+
let completions = crate::engine::complete(cmd, args, index, current_dir)?;
245245

246246
for (i, candidate) in completions.iter().enumerate() {
247247
if i != 0 {
@@ -335,7 +335,7 @@ set edit:completion:arg-completer[BIN] = { |@words|
335335
.and_then(|i| i.parse().ok())
336336
.unwrap_or_default();
337337
let ifs: Option<String> = std::env::var("_CLAP_IFS").ok().and_then(|i| i.parse().ok());
338-
let completions = crate::dynamic::complete(cmd, args, index, current_dir)?;
338+
let completions = crate::engine::complete(cmd, args, index, current_dir)?;
339339

340340
for (i, candidate) in completions.iter().enumerate() {
341341
if i != 0 {
@@ -376,7 +376,7 @@ impl CommandCompleter for Fish {
376376
buf: &mut dyn std::io::Write,
377377
) -> Result<(), std::io::Error> {
378378
let index = args.len() - 1;
379-
let completions = crate::dynamic::complete(cmd, args, index, current_dir)?;
379+
let completions = crate::engine::complete(cmd, args, index, current_dir)?;
380380

381381
for candidate in completions {
382382
write!(buf, "{}", candidate.get_content().to_string_lossy())?;
@@ -442,7 +442,7 @@ Register-ArgumentCompleter -Native -CommandName {bin} -ScriptBlock {{
442442
buf: &mut dyn std::io::Write,
443443
) -> Result<(), std::io::Error> {
444444
let index = args.len() - 1;
445-
let completions = crate::dynamic::complete(cmd, args, index, current_dir)?;
445+
let completions = crate::engine::complete(cmd, args, index, current_dir)?;
446446

447447
for candidate in completions {
448448
write!(buf, "{}", candidate.get_content().to_string_lossy())?;
@@ -516,7 +516,7 @@ compdef _clap_dynamic_completer BIN"#
516516
if args.len() == index {
517517
args.push("".into());
518518
}
519-
let completions = crate::dynamic::complete(cmd, args, index, current_dir)?;
519+
let completions = crate::engine::complete(cmd, args, index, current_dir)?;
520520

521521
for (i, candidate) in completions.iter().enumerate() {
522522
if i != 0 {

clap_complete/src/dynamic/candidate.rs clap_complete/src/engine/candidate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl CompletionCandidate {
3737

3838
/// Add a prefix to the content of completion candidate
3939
///
40-
/// This is generally used for post-process by [`complete`][crate::dynamic::complete()] for
40+
/// This is generally used for post-process by [`complete`][crate::engine::complete()] for
4141
/// things like pre-pending flags, merging delimiter-separated values, etc.
4242
pub fn add_prefix(mut self, prefix: impl Into<OsString>) -> Self {
4343
let suffix = self.content;
File renamed without changes.

clap_complete/src/dynamic/custom.rs clap_complete/src/engine/custom.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use super::CompletionCandidate;
1111
///
1212
/// ```rust
1313
/// use clap::Parser;
14-
/// use clap_complete::dynamic::{ArgValueCompleter, CompletionCandidate};
14+
/// use clap_complete::engine::{ArgValueCompleter, CompletionCandidate};
1515
///
1616
/// #[derive(Debug, Parser)]
1717
/// struct Cli {
File renamed without changes.

clap_complete/src/env/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl<'s> Shells<'s> {
273273
///
274274
/// This will generally be called by [`CompleteEnv`].
275275
///
276-
/// This handles adapting between the shell and [`completer`][crate::dynamic::complete()].
276+
/// This handles adapting between the shell and [`completer`][crate::engine::complete()].
277277
/// A `EnvCompleter` can choose how much of that lives within the registration script or
278278
/// lives in [`EnvCompleter::write_complete`].
279279
pub trait EnvCompleter {
@@ -308,9 +308,9 @@ pub trait EnvCompleter {
308308
/// Complete the given command
309309
///
310310
/// Adapt information from arguments and [`EnvCompleter::write_registration`]-defined env
311-
/// variables to what is needed for [`completer`][crate::dynamic::complete()].
311+
/// variables to what is needed for [`completer`][crate::engine::complete()].
312312
///
313-
/// Write out the [`CompletionCandidate`][crate::dynamic::CompletionCandidate]s in a way the shell will understand.
313+
/// Write out the [`CompletionCandidate`][crate::engine::CompletionCandidate]s in a way the shell will understand.
314314
fn write_complete(
315315
&self,
316316
cmd: &mut clap::Command,

clap_complete/src/env/shells.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fi
8686
.ok()
8787
.and_then(|i| i.parse().ok());
8888
let ifs: Option<String> = std::env::var("IFS").ok().and_then(|i| i.parse().ok());
89-
let completions = crate::dynamic::complete(cmd, args, index, current_dir)?;
89+
let completions = crate::engine::complete(cmd, args, index, current_dir)?;
9090

9191
for (i, candidate) in completions.iter().enumerate() {
9292
if i != 0 {
@@ -189,7 +189,7 @@ set edit:completion:arg-completer[BIN] = { |@words|
189189
.and_then(|i| i.parse().ok())
190190
.unwrap_or_default();
191191
let ifs: Option<String> = std::env::var("_CLAP_IFS").ok().and_then(|i| i.parse().ok());
192-
let completions = crate::dynamic::complete(cmd, args, index, current_dir)?;
192+
let completions = crate::engine::complete(cmd, args, index, current_dir)?;
193193

194194
for (i, candidate) in completions.iter().enumerate() {
195195
if i != 0 {
@@ -237,7 +237,7 @@ impl EnvCompleter for Fish {
237237
buf: &mut dyn std::io::Write,
238238
) -> Result<(), std::io::Error> {
239239
let index = args.len() - 1;
240-
let completions = crate::dynamic::complete(cmd, args, index, current_dir)?;
240+
let completions = crate::engine::complete(cmd, args, index, current_dir)?;
241241

242242
for candidate in completions {
243243
write!(buf, "{}", candidate.get_content().to_string_lossy())?;
@@ -310,7 +310,7 @@ Register-ArgumentCompleter -Native -CommandName {bin} -ScriptBlock {{
310310
buf: &mut dyn std::io::Write,
311311
) -> Result<(), std::io::Error> {
312312
let index = args.len() - 1;
313-
let completions = crate::dynamic::complete(cmd, args, index, current_dir)?;
313+
let completions = crate::engine::complete(cmd, args, index, current_dir)?;
314314

315315
for candidate in completions {
316316
write!(buf, "{}", candidate.get_content().to_string_lossy())?;
@@ -393,7 +393,7 @@ compdef _clap_dynamic_completer BIN"#
393393
if args.len() == index {
394394
args.push("".into());
395395
}
396-
let completions = crate::dynamic::complete(cmd, args, index, current_dir)?;
396+
let completions = crate::engine::complete(cmd, args, index, current_dir)?;
397397

398398
for (i, candidate) in completions.iter().enumerate() {
399399
if i != 0 {

clap_complete/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub mod aot;
6969
#[cfg(feature = "unstable-command")]
7070
pub mod command;
7171
#[cfg(feature = "unstable-dynamic")]
72-
pub mod dynamic;
72+
pub mod engine;
7373
#[cfg(feature = "unstable-dynamic")]
7474
pub mod env;
7575

@@ -80,10 +80,10 @@ pub use command::CompleteArgs;
8080
pub use command::CompleteCommand;
8181
#[doc(inline)]
8282
#[cfg(feature = "unstable-dynamic")]
83-
pub use dynamic::ArgValueCompleter;
83+
pub use engine::ArgValueCompleter;
8484
#[doc(inline)]
8585
#[cfg(feature = "unstable-dynamic")]
86-
pub use dynamic::CompletionCandidate;
86+
pub use engine::CompletionCandidate;
8787
#[cfg(feature = "unstable-dynamic")]
8888
pub use env::CompleteEnv;
8989

0 commit comments

Comments
 (0)