aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-19 22:24:00 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-19 22:24:00 +0800
commite3c75c660e9d9387184ff43b14c070afedd069c6 (patch)
tree9ba28c8ec7796e6ecfd011dc5ac8941dfc9d3f56
parentef9e20a62553027384ab9228cc2ae59849548626 (diff)
feat(multishell): add `picker` feature gate and deprecate conflicting
methods Deprecate `ShellContext` methods `filling_argument_first`, `filling_argument`, `typing_argument`, `strip_typed_argument`, and `get_typed_arguments` when the `picker` feature is active, as they do not work under all `ParserStyle` settings. Add `#![allow(deprecated)]` to the affected modules to suppress warnings from internal usage.
-rw-r--r--mingling/Cargo.toml2
-rw-r--r--mingling_core/Cargo.toml1
-rw-r--r--mingling_core/src/comp/shell_ctx.rs34
-rw-r--r--mingling_core/src/comp/suggest.rs8
4 files changed, 44 insertions, 1 deletions
diff --git a/mingling/Cargo.toml b/mingling/Cargo.toml
index adf900f..2509029 100644
--- a/mingling/Cargo.toml
+++ b/mingling/Cargo.toml
@@ -50,7 +50,7 @@ dispatch_tree = ["mingling_core/dispatch_tree", "mingling_macros/dispatch_tree"]
repl = ["mingling_core/repl", "mingling_macros/repl"]
comp = ["mingling_core/comp", "mingling_macros/comp"]
parser = ["dep:size"]
-picker = ["dep:arg-picker", "arg-picker/mingling_support"]
+picker = ["mingling_core/picker", "dep:arg-picker", "arg-picker/mingling_support"]
pathf = ["mingling_core/pathf", "mingling_macros/pathf"]
structural_renderer = [
diff --git a/mingling_core/Cargo.toml b/mingling_core/Cargo.toml
index 85afd55..14140c6 100644
--- a/mingling_core/Cargo.toml
+++ b/mingling_core/Cargo.toml
@@ -15,6 +15,7 @@ nightly = []
default = []
async = []
builds = []
+picker = []
dispatch_tree = []
structural_renderer = ["dep:serde"]
diff --git a/mingling_core/src/comp/shell_ctx.rs b/mingling_core/src/comp/shell_ctx.rs
index cfa4700..1fca325 100644
--- a/mingling_core/src/comp/shell_ctx.rs
+++ b/mingling_core/src/comp/shell_ctx.rs
@@ -1,3 +1,5 @@
+#![allow(deprecated)]
+
use std::collections::HashSet;
use crate::{Flag, ShellFlag, Suggest};
@@ -115,6 +117,13 @@ impl ShellContext {
/// // }
/// }
/// ```
+ #[must_use]
+ #[cfg_attr(
+ feature = "picker",
+ deprecated(
+ note = "When using the `picker` feature, this method does not work under all ParserStyle settings"
+ )
+ )]
pub fn filling_argument_first(&self, flag: impl Into<Flag>) -> bool {
let flag = flag.into();
if self.filling_argument(&flag) {
@@ -153,6 +162,13 @@ impl ShellContext {
/// // }
/// }
/// ```
+ #[must_use]
+ #[cfg_attr(
+ feature = "picker",
+ deprecated(
+ note = "When using the `picker` feature, this method does not work under all ParserStyle settings"
+ )
+ )]
pub fn filling_argument(&self, flag: impl Into<Flag>) -> bool {
for f in flag.into().iter() {
if self.previous_word == **f {
@@ -190,6 +206,12 @@ impl ShellContext {
/// }
/// ```
#[must_use]
+ #[cfg_attr(
+ feature = "picker",
+ deprecated(
+ note = "When using the `picker` feature, this method does not work under all ParserStyle settings"
+ )
+ )]
pub fn typing_argument(&self) -> bool {
#[cfg(target_os = "windows")]
{
@@ -208,6 +230,12 @@ impl ShellContext {
/// when the user has already typed certain flags. The method processes both
/// regular suggestion sets and file completion suggestions differently.
#[must_use]
+ #[cfg_attr(
+ feature = "picker",
+ deprecated(
+ note = "When using the `picker` feature, this method does not work under all ParserStyle settings"
+ )
+ )]
pub fn strip_typed_argument(&self, suggest: Suggest) -> Suggest {
let typed = Self::get_typed_arguments(self);
match suggest {
@@ -225,6 +253,12 @@ impl ShellContext {
/// which typically represent command-line flags or options. It returns a vector
/// containing these flag strings, converted to owned `String` values.
#[must_use]
+ #[cfg_attr(
+ feature = "picker",
+ deprecated(
+ note = "When using the `picker` feature, this method does not work under all ParserStyle settings"
+ )
+ )]
pub fn get_typed_arguments(&self) -> HashSet<String> {
self.all_words
.iter()
diff --git a/mingling_core/src/comp/suggest.rs b/mingling_core/src/comp/suggest.rs
index a81de64..99afc54 100644
--- a/mingling_core/src/comp/suggest.rs
+++ b/mingling_core/src/comp/suggest.rs
@@ -1,3 +1,5 @@
+#![allow(deprecated)]
+
use std::collections::BTreeSet;
use crate::ShellContext;
@@ -30,6 +32,12 @@ impl Suggest {
/// Filters out already typed flag arguments from suggestion results.
#[must_use]
+ #[cfg_attr(
+ feature = "picker",
+ deprecated(
+ note = "When using the `picker` feature, this method does not work under all ParserStyle settings"
+ )
+ )]
pub fn strip_typed_argument(self, ctx: &ShellContext) -> Self {
ctx.strip_typed_argument(self)
}