From 5ba717fc4cde4aa8b43cd81b44f8b3106ff56b56 Mon Sep 17 00:00:00 2001 From: Arne Beer Date: Sun, 2 Jan 2022 17:59:21 +0100 Subject: [PATCH] chore: Update to clap v3 --- CHANGELOG.md | 6 +++++- Cargo.lock | 47 ++++++++++++++++++++--------------------------- Cargo.toml | 28 +++++++++++++++++----------- client/cli.rs | 10 +++++----- client/main.rs | 15 +++++++-------- daemon/cli.rs | 11 +++-------- daemon/main.rs | 2 +- 7 files changed, 58 insertions(+), 61 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b486da4d..9b331f84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [1.0.5] - unreleased +## [1.0.5] - 2022-01-02 + +### Changed + +- Update to stable clap v3.0. ### Fix diff --git a/Cargo.lock b/Cargo.lock index 746f5c09..ae999f0e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -373,9 +373,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.0.0-beta.4" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcd70aa5597dbc42f7217a543f9ef2768b2ef823ba29036072d30e1d88e98406" +checksum = "d17bf219fcd37199b9a29e00ba65dfb8cd5b2688b7297ec14ff829c40ac50ca9" dependencies = [ "atty", "bitflags", @@ -386,14 +386,22 @@ dependencies = [ "strsim", "termcolor", "textwrap", - "vec_map", +] + +[[package]] +name = "clap_complete" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60d123fbea4c5d9799cffd44051e2125c880efd23b3b7c529baf3ea5508c8736" +dependencies = [ + "clap", ] [[package]] name = "clap_derive" -version = "3.0.0-beta.4" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5bb0d655624a0b8770d1c178fb8ffcb1f91cc722cb08f451e3dc72465421ac" +checksum = "e1b9752c030a14235a0bd5ef3ad60a1dcac8468c30921327fc8af36b20c790b9" dependencies = [ "heck", "proc-macro-error", @@ -402,15 +410,6 @@ dependencies = [ "syn", ] -[[package]] -name = "clap_generate" -version = "3.0.0-beta.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d9b1abef93569f290952eff3c4a0a92d6767bb5158db095b4dc9a512b1c3643" -dependencies = [ - "clap", -] - [[package]] name = "clicolors-control" version = "1.0.1" @@ -1029,9 +1028,12 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" [[package]] name = "os_str_bytes" -version = "3.1.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6acbef58a60fe69ab50510a55bc8cdd4d6cf2283d27ad338f54cb52747a9cf2d" +checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" +dependencies = [ + "memchr", +] [[package]] name = "output_vt100" @@ -1246,7 +1248,7 @@ dependencies = [ [[package]] name = "pueue" -version = "1.0.4" +version = "1.0.5" dependencies = [ "anyhow", "assert_cmd", @@ -1254,7 +1256,7 @@ dependencies = [ "chrono", "chrono-english", "clap", - "clap_generate", + "clap_complete", "comfy-table", "crossbeam-channel", "crossterm", @@ -1751,9 +1753,6 @@ name = "textwrap" version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80" -dependencies = [ - "unicode-width", -] [[package]] name = "thiserror" @@ -1862,12 +1861,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.3" diff --git a/Cargo.toml b/Cargo.toml index beebec50..4b925575 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pueue" description = "A cli tool for managing long running shell commands." -version = "1.0.4" +version = "1.0.5" authors = ["Arne Beer "] homepage = "https://github.com/nukesor/pueue" repository = "https://github.com/nukesor/pueue" @@ -12,7 +12,7 @@ readme = "README.md" edition = "2018" [badges] -maintenance = { status = "actively-developed" } +maintenance = { status="actively-developed" } [[bin]] name = "pueue" @@ -35,31 +35,37 @@ pueue-lib = "0.18.0" #pueue-lib = { path = "../../libraries/pueue-lib" } anyhow = "1" -chrono = { version = "0.4", features = ["serde"] } +chrono = { version="0.4", features=["serde"] } chrono-english = "0.1" shell-escape = "0.1" tempfile = "3" crossbeam-channel = "0.5" -tokio = { version = "1", features = ["rt-multi-thread", "time", "macros", "io-std", "io-util"] } +tokio = { version="1", features=["rt-multi-thread", "time", "macros", "io-std", "io-util"] } snap = "1" serde = "1" serde_json = "1" serde_derive = "1" log = "0.4" -simplelog = { version = "0.10", default-features = false } -clap = "=3.0.0-beta.4" -clap_generate = "3.0.0-beta.4" +simplelog = { version="0.10", default-features=false } +clap = { version="3", features=["derive", "cargo"] } +clap_complete = "3" crossterm = "0.20" -comfy-table= "4" +comfy-table = "4" handlebars = "4" -ctrlc = { version = "3", features = ["termination"] } +ctrlc = { version="3", features=["termination"] } # Windows [target.'cfg(windows)'.dependencies] -winapi = { version = "0.3", features = ["tlhelp32", "handleapi", "processthreadsapi", "minwindef", "impl-default"] } +winapi = { version="0.3", features=[ + "tlhelp32", + "handleapi", + "processthreadsapi", + "minwindef", + "impl-default", +] } # Unix [target.'cfg(not(windows))'.dependencies] @@ -68,7 +74,7 @@ whoami = "1" # Linux / Freebsd [target.'cfg(any(target_os = "linux", target_os = "freebsd"))'.dependencies] -procfs = { version = "0.9", default-features = false } +procfs = { version="0.9", default-features=false } [build-dependencies] version_check = "0.9" diff --git a/client/cli.rs b/client/cli.rs index a4c535a0..0ab1e697 100644 --- a/client/cli.rs +++ b/client/cli.rs @@ -3,11 +3,11 @@ use std::path::PathBuf; use chrono::prelude::*; use chrono::Duration; use chrono_english::*; -use clap::{ArgEnum, Clap}; +use clap::{ArgEnum, Parser}; use pueue_lib::network::message::Signal; -#[derive(Clap, Debug)] +#[derive(Parser, Debug)] pub enum SubCommand { /// Enqueue a task for execution. Add { @@ -235,7 +235,7 @@ pub enum SubCommand { /// Send a UNIX signal instead of simply killing the process. /// DISCLAIMER: This bypasses Pueue's process handling logic! /// You might enter weird invalid states, use at your own descretion. - #[clap(short, long, case_insensitive(true))] + #[clap(short, long, ignore_case(true))] signal: Option, }, @@ -390,7 +390,7 @@ pub enum SubCommand { }, } -#[derive(Clap, Debug, PartialEq, ArgEnum)] +#[derive(Parser, ArgEnum, Debug, Clone, PartialEq)] pub enum Shell { Bash, Elvish, @@ -399,7 +399,7 @@ pub enum Shell { Zsh, } -#[derive(Clap, Debug)] +#[derive(Parser, Debug)] #[clap( name = "Pueue client", about = "Interact with the Pueue daemon", diff --git a/client/main.rs b/client/main.rs index b79e34a7..7b637ba8 100644 --- a/client/main.rs +++ b/client/main.rs @@ -1,7 +1,6 @@ use anyhow::{Context, Result}; -use clap::{Clap, IntoApp}; -use clap_generate::generate_to; -use clap_generate::generators::*; +use clap::{IntoApp, Parser}; +use clap_complete::{generate_to, shells}; use simplelog::{Config, LevelFilter, SimpleLogger}; use pueue_lib::settings::Settings; @@ -27,13 +26,13 @@ async fn main() -> Result<()> { let mut app = CliArguments::into_app(); app.set_bin_name("pueue"); let completion_result = match shell { - Shell::Bash => generate_to::(&mut app, "pueue", output_directory), - Shell::Elvish => generate_to::(&mut app, "pueue", output_directory), - Shell::Fish => generate_to::(&mut app, "pueue", output_directory), + Shell::Bash => generate_to(shells::Bash, &mut app, "pueue", output_directory), + Shell::Elvish => generate_to(shells::Elvish, &mut app, "pueue", output_directory), + Shell::Fish => generate_to(shells::Fish, &mut app, "pueue", output_directory), Shell::PowerShell => { - generate_to::(&mut app, "pueue", output_directory) + generate_to(shells::PowerShell, &mut app, "pueue", output_directory) } - Shell::Zsh => generate_to::(&mut app, "pueue", output_directory), + Shell::Zsh => generate_to(shells::Zsh, &mut app, "pueue", output_directory), }; completion_result.context(format!("Failed to generate completions for {:?}", shell))?; return Ok(()); diff --git a/daemon/cli.rs b/daemon/cli.rs index 7c8e0f3f..720376a5 100644 --- a/daemon/cli.rs +++ b/daemon/cli.rs @@ -1,14 +1,9 @@ use std::path::PathBuf; -use clap::Clap; +use clap::Parser; -#[derive(Clap, Debug)] -#[clap( - name = "Pueue daemon", - about = "Start the daemon for pueue", - author = env!("CARGO_PKG_AUTHORS"), - version = env!("CARGO_PKG_VERSION") -)] +#[derive(Parser, Debug)] +#[clap(name = "Pueue daemon", about, author, version)] pub struct CliArguments { /// Verbose mode (-v, -vv, -vvv) #[clap(short, long, parse(from_occurrences))] diff --git a/daemon/main.rs b/daemon/main.rs index eb10bc3d..5ea10c24 100644 --- a/daemon/main.rs +++ b/daemon/main.rs @@ -1,7 +1,7 @@ use std::process::Command; use anyhow::Result; -use clap::Clap; +use clap::Parser; use simplelog::{Config, LevelFilter, SimpleLogger}; use pueue_daemon_lib::cli::CliArguments;