Skip to content

Commit bfa5aa0

Browse files
committed
fix: allow period to be specified with any case
fixes #63
1 parent 599ad1b commit bfa5aa0

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

ledger/cmd/printBalance.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var balanceCmd = &cobra.Command{
2323
if period == "" {
2424
PrintBalances(ledger.GetBalances(generalLedger, args), showEmptyAccounts, transactionDepth, columnWidth)
2525
} else {
26-
lperiod := ledger.Period(period)
26+
lperiod := ledger.Period(strings.Title(period))
2727
rtrans := ledger.TransactionsByPeriod(generalLedger, lperiod)
2828
for rIdx, rt := range rtrans {
2929
balances := ledger.GetBalances(rt.Transactions, args)

ledger/cmd/printRegister.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var registerCmd = &cobra.Command{
2323
if period == "" {
2424
PrintRegister(generalLedger, args, columnWidth)
2525
} else {
26-
lperiod := ledger.Period(period)
26+
lperiod := ledger.Period(strings.Title(period))
2727
rtrans := ledger.TransactionsByPeriod(generalLedger, lperiod)
2828
for rIdx, rt := range rtrans {
2929
if len(rt.Transactions) < 1 {

ledger/cmd/webHandlerReport.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
)
1616

1717
func getRangeAndPeriod(dateRange, dateFreq string) (start, end time.Time, period ledger.Period, err error) {
18-
period = ledger.Period(dateFreq)
18+
period = ledger.Period(strings.Title(dateFreq))
1919

2020
start, end, err = pdr.ParseRange(dateRange, time.Now())
2121

ledger/man/ledger.1

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ End date of transactions to include in processing.
8080
Filter transactions used in processing to payees that contain this string.
8181
.It Fl \-period Ar STR
8282
Split output into multiple results based on specified period. Valid options are:
83+
.Sy Daily ,
84+
.Sy Weekly ,
85+
.Sy BiWeekly ,
8386
.Sy Monthly ,
87+
.Sy BiMonthly ,
8488
.Sy Quarterly ,
8589
.Sy SemiYearly ,
8690
.Sy Yearly
@@ -126,7 +130,11 @@ End date of transactions to include in processing.
126130
Filter transactions used in processing to payees that contain this string.
127131
.It Fl \-period Ar STR
128132
Split output into multiple results based on specified period. Valid options are:
133+
.Sy Daily ,
134+
.Sy Weekly ,
135+
.Sy BiWeekly ,
129136
.Sy Monthly ,
137+
.Sy BiMonthly ,
130138
.Sy Quarterly ,
131139
.Sy SemiYearly ,
132140
.Sy Yearly
@@ -165,7 +173,9 @@ match the
165173
.Ar account-filter .
166174
The purpose of this is to close the books for a period. The equity transaction
167175
can be used as an inital transaction in a new file to start a new period. The
168-
amount necessary to balance the transaction is assigned to the Equity account.
176+
amount necessary to balance the transaction is assigned to the
177+
.Sy Equity
178+
account.
169179
Options available for this command are:
170180
.Bl -tag -compact -width "--begin-date (b) YYYY-mm-dd "
171181
.It Fl \-begin-date ( Fl b ) Ar YYYY-mm-dd

0 commit comments

Comments
 (0)