diff --git a/Program.cs b/Program.cs
index cd3ef8d..2982572 100644
--- a/Program.cs
+++ b/Program.cs
@@ -2,17 +2,23 @@
using System.Collections.Generic;
using System.Globalization;
using System.IO;
-using System.Linq;
+using System.CommandLine.DragonFruit;
using CsvHelper;
-using BunyMuny;
+using CsvHelper.Configuration.Attributes;
namespace BunyMuny {
class Program {
- static int Main(string[] args) {
+ ///
+ /// BunyMuny parses the CSV output of various bank statement listings and converts it to something more human readable with nice visualisations.
+ ///
+ /// The CSV file to read
+ /// The JSON file to use for rules when parsing statement descriptions
+ ///
+ static int Main(string file = "test.csv", string rules = "rules.json") {
Bank bank = Bank.ME;
var statements = new List();
- using (var sr = new StreamReader("/mnt/code/cs/bunymuny/test.csv")) {
+ using (var sr = new StreamReader(file)) {
using (var csv = new CsvReader(sr, CultureInfo.InvariantCulture)) {
csv.Read();
csv.ReadHeader();
@@ -40,6 +46,10 @@ namespace BunyMuny {
Value = value
});
break;
+
+ default:
+ Console.WriteLine(":(");
+ return 1;
}
}
diff --git a/Statement.cs b/Statement.cs
index 585a03d..855b75e 100644
--- a/Statement.cs
+++ b/Statement.cs
@@ -3,12 +3,18 @@ using System;
namespace BunyMuny {
public class Statement {
public DateTime Date;
- public string Description;
+ private string _description;
+ public string Description {
+ get => string.IsNullOrWhiteSpace(_description) ? OriginalDescription : _description;
+ set { _description = value; }
+ }
+
+ public string OriginalDescription;
public double Value;
public string Category;
public override string ToString() {
- return $"${Math.Abs(Value)} {(Value < 0 ? "to" : "from")} {Description} on {Date.ToString("MMM d yyyy")}";
+ return $"${Math.Abs(Value)} {(Value < 0 ? "to" : "from")} {(Description)} on {Date.ToString("MMM d yyyy")}";
}
}
}
diff --git a/bunymuny.csproj b/bunymuny.csproj
index 9a396eb..ba27042 100644
--- a/bunymuny.csproj
+++ b/bunymuny.csproj
@@ -7,6 +7,12 @@
+
+
+
+ $(MSBuildProjectDirectory)
+
+