Skip to content

Commit

Permalink
limport: can specify destination classification account search parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
howeyc committed Dec 11, 2020
1 parent 367f8eb commit 6d53aef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/limport/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func usage() {
func main() {
var ledgerFileName string
var accountSubstring, csvFileName, csvDateFormat string
var destAccSearch string
var negateAmount bool
var allowMatching bool
var fieldDelimiter string
Expand All @@ -37,6 +38,7 @@ func main() {
flag.BoolVar(&negateAmount, "neg", false, "Negate amount column value.")
flag.BoolVar(&allowMatching, "allow-matching", false, "Have output include imported transactions that\nmatch existing ledger transactions.")
flag.Float64Var(&scaleFactor, "scale", 1.0, "Scale factor to multiply against every imported amount.")
flag.StringVar(&destAccSearch, "set-search", "Expense", "Search string used to find set of accounts for classification.")
flag.StringVar(&ledgerFileName, "f", "", "Ledger file name (*Required).")
flag.StringVar(&csvDateFormat, "date-format", "01/02/2006", "Date format.")
flag.StringVar(&fieldDelimiter, "delimiter", ",", "Field delimiter.")
Expand Down Expand Up @@ -98,7 +100,7 @@ func main() {
for _, tran := range generalLedger {
payeeWords := strings.Split(tran.Payee, " ")
for _, accChange := range tran.AccountChanges {
if strings.Contains(accChange.Name, "Expense") {
if strings.Contains(accChange.Name, destAccSearch) {
classifier.Learn(payeeWords, bayesian.Class(accChange.Name))
}
}
Expand Down

0 comments on commit 6d53aef

Please sign in to comment.