Changed structopt dependency to clap and updated to latest version.

This commit is contained in:
scoobybejesus 2023-10-23 18:07:24 -04:00
parent e983fb2234
commit 60ccbfb1ff
4 changed files with 141 additions and 161 deletions

272
Cargo.lock generated
View File

@ -46,12 +46,51 @@ dependencies = [
]
[[package]]
name = "ansi_term"
version = "0.11.0"
name = "anstream"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44"
dependencies = [
"winapi",
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"
[[package]]
name = "anstyle-parse"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
dependencies = [
"windows-sys",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628"
dependencies = [
"anstyle",
"windows-sys",
]
[[package]]
@ -60,17 +99,6 @@ version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi",
]
[[package]]
name = "autocfg"
version = "1.1.0"
@ -120,7 +148,7 @@ dependencies = [
"borsh-derive-internal",
"borsh-schema-derive-internal",
"proc-macro-crate",
"proc-macro2 1.0.69",
"proc-macro2",
"syn 1.0.109",
]
@ -130,8 +158,8 @@ version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb"
dependencies = [
"proc-macro2 1.0.69",
"quote 1.0.33",
"proc-macro2",
"quote",
"syn 1.0.109",
]
@ -141,8 +169,8 @@ version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd"
dependencies = [
"proc-macro2 1.0.69",
"quote 1.0.33",
"proc-macro2",
"quote",
"syn 1.0.109",
]
@ -169,8 +197,8 @@ version = "0.6.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61"
dependencies = [
"proc-macro2 1.0.69",
"quote 1.0.33",
"proc-macro2",
"quote",
"syn 1.0.109",
]
@ -224,19 +252,45 @@ dependencies = [
[[package]]
name = "clap"
version = "2.33.3"
version = "4.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956"
dependencies = [
"ansi_term",
"atty",
"bitflags 1.3.2",
"strsim",
"textwrap",
"unicode-width",
"vec_map",
"clap_builder",
"clap_derive",
]
[[package]]
name = "clap_builder"
version = "4.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
"strsim",
"terminal_size",
]
[[package]]
name = "clap_derive"
version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 2.0.38",
]
[[package]]
name = "clap_lex"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961"
[[package]]
name = "clipboard-win"
version = "4.5.0"
@ -248,6 +302,12 @@ dependencies = [
"winapi",
]
[[package]]
name = "colorchoice"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "core-foundation-sys"
version = "0.8.4"
@ -281,7 +341,7 @@ dependencies = [
[[package]]
name = "crptls"
version = "0.2.2"
version = "0.2.3"
dependencies = [
"chrono",
"csv",
@ -294,9 +354,10 @@ dependencies = [
[[package]]
name = "cryptools"
version = "0.12.6"
version = "0.12.7"
dependencies = [
"chrono",
"clap",
"crptls",
"csv",
"dotenv",
@ -304,7 +365,6 @@ dependencies = [
"rust_decimal",
"rust_decimal_macros",
"rustyline",
"structopt",
"termion",
]
@ -432,30 +492,12 @@ dependencies = [
"allocator-api2",
]
[[package]]
name = "heck"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
dependencies = [
"unicode-segmentation",
]
[[package]]
name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hermit-abi"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"
dependencies = [
"libc",
]
[[package]]
name = "home"
version = "0.5.5"
@ -667,15 +709,6 @@ dependencies = [
"toml",
]
[[package]]
name = "proc-macro2"
version = "0.4.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
dependencies = [
"unicode-xid",
]
[[package]]
name = "proc-macro2"
version = "1.0.69"
@ -700,27 +733,18 @@ version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac"
dependencies = [
"proc-macro2 1.0.69",
"quote 1.0.33",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "quote"
version = "0.6.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
dependencies = [
"proc-macro2 0.4.30",
]
[[package]]
name = "quote"
version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
dependencies = [
"proc-macro2 1.0.69",
"proc-macro2",
]
[[package]]
@ -853,8 +877,8 @@ version = "0.7.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d"
dependencies = [
"proc-macro2 1.0.69",
"quote 1.0.33",
"proc-macro2",
"quote",
"syn 1.0.109",
]
@ -880,7 +904,7 @@ version = "1.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86444b802de0b10ac5e563b5ddb43b541b9705de4e01a50e82194d2b183c1835"
dependencies = [
"quote 1.0.33",
"quote",
"rust_decimal",
]
@ -959,8 +983,8 @@ version = "1.0.189"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5"
dependencies = [
"proc-macro2 1.0.69",
"quote 1.0.33",
"proc-macro2",
"quote",
"syn 2.0.38",
]
@ -1025,31 +1049,9 @@ checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0"
[[package]]
name = "strsim"
version = "0.8.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "structopt"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16c2cdbf9cc375f15d1b4141bc48aeef444806655cd0e904207edc8d68d86ed7"
dependencies = [
"clap",
"structopt-derive",
]
[[package]]
name = "structopt-derive"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53010261a84b37689f9ed7d395165029f9cc7abb9f56bbfe86bee2597ed25107"
dependencies = [
"heck 0.3.1",
"proc-macro2 0.4.30",
"quote 0.6.13",
"syn 0.15.44",
]
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "strum"
@ -1066,32 +1068,21 @@ version = "0.25.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0"
dependencies = [
"heck 0.4.1",
"proc-macro2 1.0.69",
"quote 1.0.33",
"heck",
"proc-macro2",
"quote",
"rustversion",
"syn 2.0.38",
]
[[package]]
name = "syn"
version = "0.15.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.13",
"unicode-xid",
]
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2 1.0.69",
"quote 1.0.33",
"proc-macro2",
"quote",
"unicode-ident",
]
@ -1101,8 +1092,8 @@ version = "2.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b"
dependencies = [
"proc-macro2 1.0.69",
"quote 1.0.33",
"proc-macro2",
"quote",
"unicode-ident",
]
@ -1112,6 +1103,16 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
[[package]]
name = "terminal_size"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7"
dependencies = [
"rustix",
"windows-sys",
]
[[package]]
name = "termion"
version = "2.0.1"
@ -1124,15 +1125,6 @@ dependencies = [
"redox_termios",
]
[[package]]
name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width",
]
[[package]]
name = "time"
version = "0.3.30"
@ -1193,12 +1185,6 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
[[package]]
name = "unicode-xid"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
[[package]]
name = "utf8parse"
version = "0.2.1"
@ -1211,12 +1197,6 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc"
[[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.4"
@ -1248,8 +1228,8 @@ dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2 1.0.69",
"quote 1.0.33",
"proc-macro2",
"quote",
"syn 2.0.38",
"wasm-bindgen-shared",
]
@ -1260,7 +1240,7 @@ version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
dependencies = [
"quote 1.0.33",
"quote",
"wasm-bindgen-macro-support",
]
@ -1270,8 +1250,8 @@ version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2 1.0.69",
"quote 1.0.33",
"proc-macro2",
"quote",
"syn 2.0.38",
"wasm-bindgen-backend",
"wasm-bindgen-shared",

View File

@ -1,6 +1,6 @@
[package]
name = "cryptools"
version = "0.12.6"
version = "0.12.7"
authors = ["scoobybejesus <scoobybejesus@users.noreply.github.com>"]
edition = "2021"
description = "Command-line utility for processing cryptocurrency transactions into 'lots' and 'movements'."
@ -24,7 +24,7 @@ csv = "1.3.0"
rust_decimal = "1.32.0"
rust_decimal_macros = "1.32.0"
chrono = { version = "0.4.31", features = ["serde"] }
structopt = "0.2.10"
clap = { version = "4.4.6", features = ["derive", "wrap_help"] }
rustyline = "12.0.0"
ratatui = { version = "0.24.0", optional = true, features = ['termion'] }
termion = { version = "2.0.1", optional = true }

View File

@ -1,6 +1,6 @@
[package]
name = "crptls"
version = "0.2.2"
version = "0.2.3"
authors = ["scoobybejesus <scoobybejesus@users.noreply.github.com>"]
edition = "2021"

View File

@ -11,7 +11,7 @@
use std::path::PathBuf;
use std::error::Error;
use structopt::StructOpt;
use clap::Parser;
mod setup;
mod cli_user_choices;
@ -25,50 +25,50 @@ mod mytui;
use export::{export_all, export_je};
#[derive(StructOpt, Debug)]
#[structopt(name = "cryptools")]
#[derive(Parser, Debug)]
#[command(name = "cryptools")]
pub struct Cli {
/// User is instructing the program to skip the data entry wizard.
/// When set, default settings will be assumed if they are not set by
/// environment variables (or .env file) or certain command line flags.
#[structopt(name = "accept args", short = "a", long = "accept")]
#[arg(id = "accept args", short, long = "accept")]
accept_args: bool,
/// Suppresses the printing of "all" reports, except that it *will* trigger the
/// exporting of a txt file containing an accounting journal entry for every transaction.
/// Individual account and transaction reports may still be printed via the print_menu
/// with the -p flag. Note: the journal entries are not suitable for like-kind transactions.
#[structopt(name = "journal entries", short, long = "journal-entries")]
#[arg(id = "journal entries", short, long = "journal-entries")]
journal_entries_only: bool,
/// Once the file_to_import has been fully processed, the user will be presented
/// with a menu for manually selecting which reports to print/export. If this flag is not
/// set, the program will print/export all available reports.
#[cfg(feature = "print_menu")]
#[structopt(name = "print menu", short, long = "print-menu")]
#[arg(id = "print menu", short, long = "print-menu")]
print_menu: bool,
/// Prevents the program from writing reports to files.
/// This will be ignored if -a is not set (the wizard will always ask to output).
#[structopt(name = "suppress reports", short, long = "suppress")]
#[arg(id = "suppress reports", short, long = "suppress")]
suppress_reports: bool,
/// Output directory for exported reports.
#[structopt(name = "output directory", short, long = "output", default_value = ".", parse(from_os_str))]
#[arg(id = "output directory", short, long = "output", default_value = ".")]
output_dir_path: PathBuf,
/// Causes the program to expect the `txDate` field in the file_to_import to use the format YYYY-MM-dd
/// or YY-MM-dd (or YYYY/MM/dd or YY/MM/dd) instead of the default US-style MM-dd-YYYY or MM-dd-YY
/// (or MM/dd/YYYY or MM/dd/YY).
/// NOTE: this flag overrides the ISO_DATE environment variable, including if set in the .env file.
#[structopt(name = "imported file uses ISO 8601 date format", short = "i", long = "iso")]
#[arg(id = "imported file uses ISO 8601 date format", short, long = "iso")]
iso_date: bool,
/// Tells the program a non-default date separator (instead of a hyphen "-", a slash "/") was used
/// in the file_to_import `txDate` column (i.e. 2017-12-31 instead of 2017/12/31).
/// NOTE: this flag overrides the DATE_SEPARATOR_IS_SLASH environment variable, including if set in the .env file.
#[structopt(name = "date separator character is slash", short = "d", long = "date-separator-is-slash")]
#[arg(id = "date separator character is slash", short, long = "date-separator-is-slash")]
date_separator_is_slash: bool,
/// File to be imported. Some notes on the columns: (a) by default, the program expects the `txDate` column to
@ -77,7 +77,7 @@ pub struct Cli {
/// separator; and (c) there is now experimental support for negative values being wrapped in parentheses. Use
/// the python script for sanitizing/converting negative values if they are a problem.
/// See .env.example for further details on environment variables.
#[structopt(name = "file_to_import", parse(from_os_str))]
#[arg(id = "file_to_import")]
file_to_import: Option<PathBuf>,
}
@ -109,7 +109,7 @@ pub struct Cfg {
fn main() -> Result<(), Box<dyn Error>> {
let args = Cli::from_args();
let args = Cli::parse();
println!(
"\