浏览代码

[Main] Receipt parameters contiguration command line options added

Signed-off-by: Slava Barinov <rayslava@gmail.com>
Slava Barinov 4 年之前
父节点
当前提交
0c1936ae4a
共有 3 个文件被更改,包括 20 次插入21 次删除
  1. 8 17
      Cargo.lock
  2. 1 1
      Cargo.toml
  3. 11 3
      src/main.rs

+ 8 - 17
Cargo.lock

@@ -85,12 +85,6 @@ version = "3.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631"
 
-[[package]]
-name = "byteorder"
-version = "1.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
-
 [[package]]
 name = "bytes"
 version = "1.0.1"
@@ -472,9 +466,9 @@ checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
 
 [[package]]
 name = "heck"
-version = "0.3.2"
+version = "0.3.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac"
+checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
 dependencies = [
  "unicode-segmentation",
 ]
@@ -938,9 +932,9 @@ dependencies = [
 
 [[package]]
 name = "qif_generator"
-version = "0.1.4"
+version = "0.1.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f5373139ce3690b7b53490402d93e53f21066e481caf5934026f9811c5912ca9"
+checksum = "67cbd79c4de2d3c133fc78442b4ca2d00051bff574a1aae7172d845965c189ba"
 dependencies = [
  "chrono",
 ]
@@ -1069,12 +1063,9 @@ dependencies = [
 
 [[package]]
 name = "regex-automata"
-version = "0.1.9"
+version = "0.1.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4"
-dependencies = [
- "byteorder",
-]
+checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
 
 [[package]]
 name = "regex-syntax"
@@ -1574,9 +1565,9 @@ dependencies = [
 
 [[package]]
 name = "unicode-normalization"
-version = "0.1.18"
+version = "0.1.19"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "33717dca7ac877f497014e10d73f3acf948c342bee31b5ca7892faf94ccc6b49"
+checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
 dependencies = [
  "tinyvec",
 ]

+ 1 - 1
Cargo.toml

@@ -7,7 +7,7 @@ edition = "2018"
 [dependencies]
 serde = { version = "1.0", features = ["derive"] }
 serde_json = "1.0"
-qif_generator = "0.1.5"
+qif_generator = "0.1.6"
 chrono = "0.4"
 pickledb = "0.4.1"
 csv = "1.1"

+ 11 - 3
src/main.rs

@@ -21,7 +21,7 @@ struct Cli {
     #[structopt(short, long)]
     database: Option<String>,
 
-    #[structopt(short, long, default_value = "New")]
+    #[structopt(long, default_value = "New")]
     memo: String,
 
     /// Run telegram bot
@@ -37,6 +37,14 @@ struct Cli {
     /// The path to the file to read
     #[structopt(required_unless_one = &["telegram", "ui"])]
     filename: Option<String>,
+
+    /// Account name
+    #[structopt(long, default_value = "Wallet")]
+    account: String,
+
+    /// Account type
+    #[structopt(long, parse(try_from_str), default_value = "Cash")]
+    account_type: AccountType,
 }
 
 #[cfg(not(tarpaulin_include))]
@@ -64,8 +72,8 @@ fn main() {
 
     // If program is used as command-line tool
     let acc = Account::new()
-        .name("Wallet")
-        .account_type(AccountType::Cash)
+        .name(&args.account)
+        .account_type(args.account_type)
         .build();
 
     if let Some(filename) = &args.filename {