Skip to content

Commit 9c6ef3e

Browse files
committed
refactor: Resolve deprecations
1 parent 82912c3 commit 9c6ef3e

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

clap_complete/src/dynamic/shells/bash.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ impl crate::dynamic::Completer for Bash {
2323
let mut upper_name = escaped_name.clone();
2424
upper_name.make_ascii_uppercase();
2525

26-
let completer = shlex::quote(completer);
26+
let completer =
27+
shlex::try_quote(completer).unwrap_or(std::borrow::Cow::Borrowed(completer));
2728

2829
let script = r#"
2930
_clap_complete_NAME() {

clap_complete/src/dynamic/shells/elvish.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ impl crate::dynamic::Completer for Elvish {
1313
completer: &str,
1414
buf: &mut dyn std::io::Write,
1515
) -> Result<(), std::io::Error> {
16-
let bin = shlex::quote(bin);
17-
let completer = shlex::quote(completer);
16+
let bin = shlex::try_quote(bin).unwrap_or(std::borrow::Cow::Borrowed(bin));
17+
let completer =
18+
shlex::try_quote(completer).unwrap_or(std::borrow::Cow::Borrowed(completer));
1819

1920
let script = r#"
2021
set edit:completion:arg-completer[BIN] = { |@words|

clap_complete/src/dynamic/shells/fish.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ impl crate::dynamic::Completer for Fish {
1313
completer: &str,
1414
buf: &mut dyn std::io::Write,
1515
) -> Result<(), std::io::Error> {
16-
let bin = shlex::quote(bin);
17-
let completer = shlex::quote(completer);
16+
let bin = shlex::try_quote(bin).unwrap_or(std::borrow::Cow::Borrowed(bin));
17+
let completer =
18+
shlex::try_quote(completer).unwrap_or(std::borrow::Cow::Borrowed(completer));
19+
1820
writeln!(
1921
buf,
2022
r#"complete -x -c {bin} -a "("'{completer}'" complete --shell fish -- (commandline --current-process --tokenize --cut-at-cursor) (commandline --current-token))""#

clap_complete/src/dynamic/shells/zsh.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ impl crate::dynamic::Completer for Zsh {
1313
completer: &str,
1414
buf: &mut dyn std::io::Write,
1515
) -> Result<(), std::io::Error> {
16-
let bin = shlex::quote(bin);
17-
let completer = shlex::quote(completer);
16+
let bin = shlex::try_quote(bin).unwrap_or(std::borrow::Cow::Borrowed(bin));
17+
let completer =
18+
shlex::try_quote(completer).unwrap_or(std::borrow::Cow::Borrowed(completer));
19+
1820
let script = r#"#compdef BIN
1921
function _clap_dynamic_completer() {
2022
export _CLAP_COMPLETE_INDEX=$(expr $CURRENT - 1)

0 commit comments

Comments
 (0)