Skip to content

Commit 17d6d24

Browse files
authored
Merge pull request #5680 from epage/unstable
docs(complete): Specify the compatibility guarentees
2 parents 23fb056 + b2c3126 commit 17d6d24

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

clap_complete/src/dynamic/command/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
//!
66
//! To source your completions:
77
//!
8+
//! **WARNING:** We recommend re-sourcing your completions on upgrade.
9+
//! These completions work by generating shell code that calls into `your_program` while completing.
10+
//! That interface is unstable and a mismatch between the shell code and `your_program` may result
11+
//! in either invalid completions or no completions being generated.
12+
//! For this reason, we recommend generating the shell code anew on shell startup so that it is
13+
//! "self-correcting" on shell launch, rather than writing the generated completions to a file.
14+
//!
815
//! Bash
916
//! ```bash
1017
//! echo "source <(your_program complete bash)" >> ~/.bashrc
@@ -207,6 +214,10 @@ pub trait CommandCompleter {
207214
///
208215
/// Write the `buf` the logic needed for calling into `<cmd> complete`, passing needed
209216
/// arguments to [`CommandCompleter::write_complete`] through the environment.
217+
///
218+
/// **WARNING:** There are no stability guarantees between the call to
219+
/// [`CommandCompleter::write_complete`] that this generates and actually calling [`CommandCompleter::write_complete`].
220+
/// Caching the results of this call may result in invalid or no completions to be generated.
210221
fn write_registration(
211222
&self,
212223
name: &str,

clap_complete/src/dynamic/env/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
//!
1919
//! To source your completions:
2020
//!
21+
//! **WARNING:** We recommend re-sourcing your completions on upgrade.
22+
//! These completions work by generating shell code that calls into `your_program` while completing.
23+
//! That interface is unstable and a mismatch between the shell code and `your_program` may result
24+
//! in either invalid completions or no completions being generated.
25+
//! For this reason, we recommend generating the shell code anew on shell startup so that it is
26+
//! "self-correcting" on shell launch, rather than writing the generated completions to a file.
27+
//!
2128
//! Bash
2229
//! ```bash
2330
//! echo "source <(COMPLETE=bash your_program)" >> ~/.bashrc
@@ -276,6 +283,10 @@ pub trait EnvCompleter {
276283
///
277284
/// Write the `buf` the logic needed for calling into `<VAR>=<shell> <cmd> --`, passing needed
278285
/// arguments to [`EnvCompleter::write_complete`] through the environment.
286+
///
287+
/// **WARNING:** There are no stability guarantees between the call to
288+
/// [`EnvCompleter::write_complete`] that this generates and actually calling [`EnvCompleter::write_complete`].
289+
/// Caching the results of this call may result in invalid or no completions to be generated.
279290
fn write_registration(
280291
&self,
281292
var: &str,

0 commit comments

Comments
 (0)