Update for clap stable

This commit is contained in:
RunasSudo 2022-06-18 22:36:00 +10:00
parent 82e90a0e10
commit 8d16f55289
No known key found for this signature in database
GPG Key ID: 7234E476BF21C61A
5 changed files with 43 additions and 50 deletions

73
Cargo.lock generated
View File

@ -174,22 +174,23 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.0.0-beta.2" version = "3.2.5"
source = "git+https://github.com/clap-rs/clap?branch=master#65b3892ef6c1ddf0cf837c76d164b8182103fa5d" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d53da17d37dba964b9b3ecb5c5a1f193a2762c700e6829201e645b9381c99dc7"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"clap_derive", "clap_derive",
"clap_lex",
"indexmap", "indexmap",
"lazy_static", "once_cell",
"os_str_bytes",
"textwrap", "textwrap",
"vec_map",
] ]
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "3.0.0-beta.2" version = "3.2.5"
source = "git+https://github.com/clap-rs/clap?branch=master#65b3892ef6c1ddf0cf837c76d164b8182103fa5d" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c11d40217d16aee8508cc8e5fde8b4ff24639758608e5374e731b53f85749fb9"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro-error", "proc-macro-error",
@ -198,6 +199,15 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "clap_lex"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5538cd660450ebeb4234cfecf8f2284b844ffc4c50531e66d584ad5b91293613"
dependencies = [
"os_str_bytes",
]
[[package]] [[package]]
name = "console_error_panic_hook" name = "console_error_panic_hook"
version = "0.1.6" version = "0.1.6"
@ -507,12 +517,9 @@ dependencies = [
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.3.2" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
dependencies = [
"unicode-segmentation",
]
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
@ -703,9 +710,9 @@ dependencies = [
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.8.0" version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
[[package]] [[package]]
name = "opaque-debug" name = "opaque-debug"
@ -747,9 +754,9 @@ dependencies = [
[[package]] [[package]]
name = "os_str_bytes" name = "os_str_bytes"
version = "3.1.0" version = "6.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6acbef58a60fe69ab50510a55bc8cdd4d6cf2283d27ad338f54cb52747a9cf2d" checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa"
[[package]] [[package]]
name = "paste" name = "paste"
@ -841,11 +848,11 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.27" version = "1.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f"
dependencies = [ dependencies = [
"unicode-xid", "unicode-ident",
] ]
[[package]] [[package]]
@ -1070,13 +1077,13 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.72" version = "1.0.96"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82" checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"unicode-xid", "unicode-ident",
] ]
[[package]] [[package]]
@ -1092,9 +1099,9 @@ dependencies = [
[[package]] [[package]]
name = "textwrap" name = "textwrap"
version = "0.13.4" version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd05616119e612a8041ef58f2b578906cc2531a6069047ae092cfb86a325d835" checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
[[package]] [[package]]
name = "treeline" name = "treeline"
@ -1115,10 +1122,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
[[package]] [[package]]
name = "unicode-segmentation" name = "unicode-ident"
version = "1.7.1" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"
@ -1126,12 +1133,6 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
[[package]]
name = "unicode-xid"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]] [[package]]
name = "utf8-chars" name = "utf8-chars"
version = "1.0.2" version = "1.0.2"
@ -1147,12 +1148,6 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cf7d77f457ef8dfa11e4cd5933c5ddb5dc52a94664071951219a97710f0a32b" checksum = "7cf7d77f457ef8dfa11e4cd5933c5ddb5dc52a94664071951219a97710f0a32b"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.3" version = "0.9.3"

View File

@ -44,9 +44,7 @@ utf8-chars = "1.0.2"
xmltree = "0.10.3" xmltree = "0.10.3"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.clap] [target.'cfg(not(target_arch = "wasm32"))'.dependencies.clap]
#version = "3.0.0-beta.4" # proc-macro2 version conflict with rkyv version = "3.2.5"
git = "https://github.com/clap-rs/clap"
branch = "master"
default-features = false default-features = false
features = ["std", "derive"] features = ["std", "derive"]

View File

@ -20,12 +20,12 @@ use crate::numbers::Rational;
use crate::parser; use crate::parser;
use crate::writer; use crate::writer;
use clap::{AppSettings, Clap}; use clap::{AppSettings, Parser};
use std::fs::File; use std::fs::File;
/// Convert between different ballot data formats /// Convert between different ballot data formats
#[derive(Clap)] #[derive(Parser)]
#[clap(setting=AppSettings::DeriveDisplayOrder)] #[clap(setting=AppSettings::DeriveDisplayOrder)]
pub struct SubcmdOptions { pub struct SubcmdOptions {
/// Path to the input data file /// Path to the input data file

View File

@ -22,7 +22,7 @@ use crate::parser::{bin, blt};
use crate::stv::{self, STVOptions}; use crate::stv::{self, STVOptions};
use crate::ties; use crate::ties;
use clap::{AppSettings, Clap}; use clap::{AppSettings, Parser};
use itertools::Itertools; use itertools::Itertools;
use std::cmp::max; use std::cmp::max;
@ -31,7 +31,7 @@ use std::io::{self, BufRead};
use std::ops; use std::ops;
/// Count a single transferable vote (STV) election /// Count a single transferable vote (STV) election
#[derive(Clap)] #[derive(Parser)]
#[clap(setting=AppSettings::DeriveDisplayOrder)] #[clap(setting=AppSettings::DeriveDisplayOrder)]
pub struct SubcmdOptions { pub struct SubcmdOptions {
// ---------------- // ----------------
@ -102,7 +102,7 @@ pub struct SubcmdOptions {
// -- STV variants -- // -- STV variants --
/// Tie-breaking method /// Tie-breaking method
#[clap(help_heading=Some("STV VARIANTS"), short='t', long, possible_values=&["forwards", "backwards", "random", "prompt"], default_value="prompt", value_name="methods")] #[clap(help_heading=Some("STV VARIANTS"), short='t', long, multiple_values=true, possible_values=&["forwards", "backwards", "random", "prompt"], default_value="prompt", value_name="methods")]
ties: Vec<String>, ties: Vec<String>,
/// Random seed to use with --ties random /// Random seed to use with --ties random

View File

@ -19,10 +19,10 @@
use opentally::cli; use opentally::cli;
use clap::Clap; use clap::Parser;
/// Open-source election vote counting /// Open-source election vote counting
#[derive(Clap)] #[derive(Parser)]
#[clap(name="OpenTally", version=opentally::VERSION)] #[clap(name="OpenTally", version=opentally::VERSION)]
struct Opts { struct Opts {
#[clap(subcommand)] #[clap(subcommand)]
@ -30,7 +30,7 @@ struct Opts {
} }
#[allow(clippy::large_enum_variant)] #[allow(clippy::large_enum_variant)]
#[derive(Clap)] #[derive(Parser)]
enum Command { enum Command {
Convert(cli::convert::SubcmdOptions), Convert(cli::convert::SubcmdOptions),
Stv(cli::stv::SubcmdOptions), Stv(cli::stv::SubcmdOptions),