mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 06:42:33 +00:00
refactor: Resolve deprecations
This commit is contained in:
parent
82912c3a51
commit
9c6ef3e057
4 changed files with 13 additions and 7 deletions
|
@ -23,7 +23,8 @@ impl crate::dynamic::Completer for Bash {
|
|||
let mut upper_name = escaped_name.clone();
|
||||
upper_name.make_ascii_uppercase();
|
||||
|
||||
let completer = shlex::quote(completer);
|
||||
let completer =
|
||||
shlex::try_quote(completer).unwrap_or(std::borrow::Cow::Borrowed(completer));
|
||||
|
||||
let script = r#"
|
||||
_clap_complete_NAME() {
|
||||
|
|
|
@ -13,8 +13,9 @@ impl crate::dynamic::Completer for Elvish {
|
|||
completer: &str,
|
||||
buf: &mut dyn std::io::Write,
|
||||
) -> Result<(), std::io::Error> {
|
||||
let bin = shlex::quote(bin);
|
||||
let completer = shlex::quote(completer);
|
||||
let bin = shlex::try_quote(bin).unwrap_or(std::borrow::Cow::Borrowed(bin));
|
||||
let completer =
|
||||
shlex::try_quote(completer).unwrap_or(std::borrow::Cow::Borrowed(completer));
|
||||
|
||||
let script = r#"
|
||||
set edit:completion:arg-completer[BIN] = { |@words|
|
||||
|
|
|
@ -13,8 +13,10 @@ impl crate::dynamic::Completer for Fish {
|
|||
completer: &str,
|
||||
buf: &mut dyn std::io::Write,
|
||||
) -> Result<(), std::io::Error> {
|
||||
let bin = shlex::quote(bin);
|
||||
let completer = shlex::quote(completer);
|
||||
let bin = shlex::try_quote(bin).unwrap_or(std::borrow::Cow::Borrowed(bin));
|
||||
let completer =
|
||||
shlex::try_quote(completer).unwrap_or(std::borrow::Cow::Borrowed(completer));
|
||||
|
||||
writeln!(
|
||||
buf,
|
||||
r#"complete -x -c {bin} -a "("'{completer}'" complete --shell fish -- (commandline --current-process --tokenize --cut-at-cursor) (commandline --current-token))""#
|
||||
|
|
|
@ -13,8 +13,10 @@ impl crate::dynamic::Completer for Zsh {
|
|||
completer: &str,
|
||||
buf: &mut dyn std::io::Write,
|
||||
) -> Result<(), std::io::Error> {
|
||||
let bin = shlex::quote(bin);
|
||||
let completer = shlex::quote(completer);
|
||||
let bin = shlex::try_quote(bin).unwrap_or(std::borrow::Cow::Borrowed(bin));
|
||||
let completer =
|
||||
shlex::try_quote(completer).unwrap_or(std::borrow::Cow::Borrowed(completer));
|
||||
|
||||
let script = r#"#compdef BIN
|
||||
function _clap_dynamic_completer() {
|
||||
export _CLAP_COMPLETE_INDEX=$(expr $CURRENT - 1)
|
||||
|
|
Loading…
Reference in a new issue