Skip to content

Commit

Permalink
chore: Update to clap v3
Browse files Browse the repository at this point in the history
  • Loading branch information
Nukesor committed Jan 2, 2022
1 parent b4b5e03 commit 5ba717f
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 61 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
47 changes: 20 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 17 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <contact@arne.beer>"]
homepage = "https://github.com/nukesor/pueue"
repository = "https://github.com/nukesor/pueue"
Expand All @@ -12,7 +12,7 @@ readme = "README.md"
edition = "2018"

[badges]
maintenance = { status = "actively-developed" }
maintenance = { status="actively-developed" }

[[bin]]
name = "pueue"
Expand All @@ -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]
Expand All @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions client/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<Signal>,
},

Expand Down Expand Up @@ -390,7 +390,7 @@ pub enum SubCommand {
},
}

#[derive(Clap, Debug, PartialEq, ArgEnum)]
#[derive(Parser, ArgEnum, Debug, Clone, PartialEq)]
pub enum Shell {
Bash,
Elvish,
Expand All @@ -399,7 +399,7 @@ pub enum Shell {
Zsh,
}

#[derive(Clap, Debug)]
#[derive(Parser, Debug)]
#[clap(
name = "Pueue client",
about = "Interact with the Pueue daemon",
Expand Down
15 changes: 7 additions & 8 deletions client/main.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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::<Bash, _, _>(&mut app, "pueue", output_directory),
Shell::Elvish => generate_to::<Elvish, _, _>(&mut app, "pueue", output_directory),
Shell::Fish => generate_to::<Fish, _, _>(&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::<PowerShell, _, _>(&mut app, "pueue", output_directory)
generate_to(shells::PowerShell, &mut app, "pueue", output_directory)
}
Shell::Zsh => generate_to::<Zsh, _, _>(&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(());
Expand Down
11 changes: 3 additions & 8 deletions daemon/cli.rs
Original file line number Diff line number Diff line change
@@ -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))]
Expand Down
2 changes: 1 addition & 1 deletion daemon/main.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 5ba717f

Please sign in to comment.