mirror of
https://github.com/nushell/nushell.git
synced 2025-04-16 09:18:21 +02:00
Change logging
This commit is contained in:
parent
d651cc30e3
commit
7480fcdf16
@ -103,19 +103,19 @@ impl<T: Completer> Completer for CustomCompletion<T> {
|
|||||||
{
|
{
|
||||||
completion_options.case_sensitive = case_sensitive;
|
completion_options.case_sensitive = case_sensitive;
|
||||||
}
|
}
|
||||||
|
let positional =
|
||||||
|
options.get("positional").and_then(|val| val.as_bool().ok());
|
||||||
|
if let Some(_positional) = positional {
|
||||||
|
log::warn!("Use of the positional option is deprecated. Use the substring match algorithm instead.");
|
||||||
|
}
|
||||||
if let Some(algorithm) = options
|
if let Some(algorithm) = options
|
||||||
.get("completion_algorithm")
|
.get("completion_algorithm")
|
||||||
.and_then(|option| option.coerce_string().ok())
|
.and_then(|option| option.coerce_string().ok())
|
||||||
.and_then(|option| option.try_into().ok())
|
.and_then(|option| option.try_into().ok())
|
||||||
{
|
{
|
||||||
completion_options.match_algorithm = algorithm;
|
completion_options.match_algorithm = algorithm;
|
||||||
if let Some(positional) =
|
if let Some(false) = positional {
|
||||||
options.get("positional").and_then(|val| val.as_bool().ok())
|
if completion_options.match_algorithm == MatchAlgorithm::Prefix {
|
||||||
{
|
|
||||||
log::warn!("Use of the positional option is deprecated. Use the substring match algorithm instead.");
|
|
||||||
if !positional
|
|
||||||
&& completion_options.match_algorithm == MatchAlgorithm::Prefix
|
|
||||||
{
|
|
||||||
completion_options.match_algorithm = MatchAlgorithm::Substring
|
completion_options.match_algorithm = MatchAlgorithm::Substring
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,6 @@ fn customcompletions_override_options() {
|
|||||||
&["Foo Abcdef", "Abcdef", "Acd Bar"],
|
&["Foo Abcdef", "Abcdef", "Acd Bar"],
|
||||||
);
|
);
|
||||||
|
|
||||||
// positional: false should make it do substring matching
|
|
||||||
// sort: true should force sorting
|
// sort: true should force sorting
|
||||||
let expected: Vec<_> = vec!["Abcdef", "Foo Abcdef"];
|
let expected: Vec<_> = vec!["Abcdef", "Foo Abcdef"];
|
||||||
let suggestions = completer.complete("my-command Abcd", 15);
|
let suggestions = completer.complete("my-command Abcd", 15);
|
||||||
|
Loading…
Reference in New Issue
Block a user