From cd8bd9af3362843cdeaf262293e752aef4c59707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20R=C3=BCberg?= Date: Tue, 13 Aug 2024 00:15:48 +0000 Subject: [PATCH] Update to clap_complete 4.5.16 and enforce exact dependency because of unstable features --- Cargo.toml | 2 +- src/lib.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fb32a0d..d9e2bf9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ path = "src/lib.rs" [dependencies] clap = { version = "4.4.10", features = ["derive"] } -clap_complete = { version = "4.5.2", features = ["unstable-dynamic"] } +clap_complete = { version = "=4.5.16", features = ["unstable-dynamic", "unstable-command"] } console = "0.15.7" nu-ansi-term = "0.50.0" reedline = "0.32.0" diff --git a/src/lib.rs b/src/lib.rs index 0902494..c76e27a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,6 @@ use std::{ffi::OsString, marker::PhantomData, path::PathBuf, str::FromStr}; -use clap::Parser; +use clap::{Parser, Subcommand}; use console::style; use nu_ansi_term::{Color, Style}; @@ -31,7 +31,7 @@ struct ReedCompleter { impl reedline::Completer for ReedCompleter { fn complete(&mut self, line: &str, pos: usize) -> Vec { let cmd = C::command(); - let mut cmd = clap_complete::dynamic::shells::CompleteCommand::augment_subcommands(cmd); + let mut cmd = clap_complete::dynamic::command::CompleteCommand::augment_subcommands(cmd); let args = Shlex::new(line); let mut args = std::iter::once("".to_owned()) .chain(args) @@ -53,8 +53,8 @@ impl reedline::Completer for ReedCompleter candidates .into_iter() .map(|c| reedline::Suggestion { - value: c.0.to_string_lossy().into_owned(), - description: c.1.map(|x| x.to_string()), + value: c.get_content().to_string_lossy().into_owned(), + description: c.get_help().map(|x| x.to_string()), style: None, extra: None, span,