Upgrade to Clap v4
This commit is contained in:
16
Cargo.lock
generated
16
Cargo.lock
generated
@@ -309,24 +309,22 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "3.2.22"
|
version = "4.0.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750"
|
checksum = "5840cd9093aabeabf7fd932754c435b7674520fc3ddc935c397837050f0f1e4b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atty",
|
"atty",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"clap_lex",
|
"clap_lex",
|
||||||
"indexmap",
|
|
||||||
"strsim",
|
"strsim",
|
||||||
"termcolor",
|
"termcolor",
|
||||||
"textwrap",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_lex"
|
name = "clap_lex"
|
||||||
version = "0.2.4"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
|
checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"os_str_bytes",
|
"os_str_bytes",
|
||||||
]
|
]
|
||||||
@@ -2954,12 +2952,6 @@ dependencies = [
|
|||||||
"redox_termios",
|
"redox_termios",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "textwrap"
|
|
||||||
version = "0.15.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.37"
|
version = "1.0.37"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ maintenance = {status = "actively-developed"}
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
clap = "3.2.17"
|
clap = "4.0.0"
|
||||||
clipboard = {version = "0.5", optional = true}
|
clipboard = {version = "0.5", optional = true}
|
||||||
crossbeam-channel = "0.5"
|
crossbeam-channel = "0.5"
|
||||||
dbus = {version = "0.9.6", optional = true}
|
dbus = {version = "0.9.6", optional = true}
|
||||||
|
|||||||
17
src/main.rs
17
src/main.rs
@@ -103,22 +103,20 @@ async fn main() -> Result<(), String> {
|
|||||||
.version(env!("CARGO_PKG_VERSION"))
|
.version(env!("CARGO_PKG_VERSION"))
|
||||||
.author("Henrik Friedrichsen <henrik@affekt.org> and contributors")
|
.author("Henrik Friedrichsen <henrik@affekt.org> and contributors")
|
||||||
.about("cross-platform ncurses Spotify client")
|
.about("cross-platform ncurses Spotify client")
|
||||||
.after_help(&*backends)
|
.after_help(backends)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("debug")
|
Arg::new("debug")
|
||||||
.short('d')
|
.short('d')
|
||||||
.long("debug")
|
.long("debug")
|
||||||
.value_name("FILE")
|
.value_name("FILE")
|
||||||
.help("Enable debug logging to the specified file")
|
.help("Enable debug logging to the specified file"),
|
||||||
.takes_value(true),
|
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("basepath")
|
Arg::new("basepath")
|
||||||
.short('b')
|
.short('b')
|
||||||
.long("basepath")
|
.long("basepath")
|
||||||
.value_name("PATH")
|
.value_name("PATH")
|
||||||
.help("custom basepath to config/cache files")
|
.help("custom basepath to config/cache files"),
|
||||||
.takes_value(true),
|
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("config")
|
Arg::new("config")
|
||||||
@@ -126,16 +124,15 @@ async fn main() -> Result<(), String> {
|
|||||||
.long("config")
|
.long("config")
|
||||||
.value_name("FILE")
|
.value_name("FILE")
|
||||||
.help("Filename of config file in basepath")
|
.help("Filename of config file in basepath")
|
||||||
.takes_value(true)
|
|
||||||
.default_value("config.toml"),
|
.default_value("config.toml"),
|
||||||
)
|
)
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
if let Some(filename) = matches.value_of("debug") {
|
if let Some(filename) = matches.get_one::<String>("debug") {
|
||||||
setup_logging(filename).expect("can't setup logging");
|
setup_logging(filename).expect("can't setup logging");
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(basepath) = matches.value_of("basepath") {
|
if let Some(basepath) = matches.get_one::<String>("basepath") {
|
||||||
let path = PathBuf::from_str(basepath).expect("invalid path");
|
let path = PathBuf::from_str(basepath).expect("invalid path");
|
||||||
if !path.exists() {
|
if !path.exists() {
|
||||||
fs::create_dir_all(&path).expect("could not create basepath directory");
|
fs::create_dir_all(&path).expect("could not create basepath directory");
|
||||||
@@ -146,7 +143,9 @@ async fn main() -> Result<(), String> {
|
|||||||
// Things here may cause the process to abort; we must do them before creating curses windows
|
// Things here may cause the process to abort; we must do them before creating curses windows
|
||||||
// otherwise the error message will not be seen by a user
|
// otherwise the error message will not be seen by a user
|
||||||
let cfg: Arc<crate::config::Config> = Arc::new(Config::new(
|
let cfg: Arc<crate::config::Config> = Arc::new(Config::new(
|
||||||
matches.value_of("config").unwrap_or("config.toml"),
|
matches
|
||||||
|
.get_one::<String>("config")
|
||||||
|
.unwrap_or(&"config.toml".to_string()),
|
||||||
));
|
));
|
||||||
let mut credentials = {
|
let mut credentials = {
|
||||||
let cache = Cache::new(Some(config::cache_path("librespot")), None, None, None)
|
let cache = Cache::new(Some(config::cache_path("librespot")), None, None, None)
|
||||||
|
|||||||
Reference in New Issue
Block a user