Skip to content

Commit

Permalink
fix: allow period to be specified with any case
Browse files Browse the repository at this point in the history
fixes #63
  • Loading branch information
howeyc committed Dec 31, 2024
1 parent 599ad1b commit bfa5aa0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ledger/cmd/printBalance.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var balanceCmd = &cobra.Command{
if period == "" {
PrintBalances(ledger.GetBalances(generalLedger, args), showEmptyAccounts, transactionDepth, columnWidth)
} else {
lperiod := ledger.Period(period)
lperiod := ledger.Period(strings.Title(period))
rtrans := ledger.TransactionsByPeriod(generalLedger, lperiod)
for rIdx, rt := range rtrans {
balances := ledger.GetBalances(rt.Transactions, args)
Expand Down
2 changes: 1 addition & 1 deletion ledger/cmd/printRegister.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var registerCmd = &cobra.Command{
if period == "" {
PrintRegister(generalLedger, args, columnWidth)
} else {
lperiod := ledger.Period(period)
lperiod := ledger.Period(strings.Title(period))
rtrans := ledger.TransactionsByPeriod(generalLedger, lperiod)
for rIdx, rt := range rtrans {
if len(rt.Transactions) < 1 {
Expand Down
2 changes: 1 addition & 1 deletion ledger/cmd/webHandlerReport.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

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

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

Expand Down
12 changes: 11 additions & 1 deletion ledger/man/ledger.1
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ End date of transactions to include in processing.
Filter transactions used in processing to payees that contain this string.
.It Fl \-period Ar STR
Split output into multiple results based on specified period. Valid options are:
.Sy Daily ,
.Sy Weekly ,
.Sy BiWeekly ,
.Sy Monthly ,
.Sy BiMonthly ,
.Sy Quarterly ,
.Sy SemiYearly ,
.Sy Yearly
Expand Down Expand Up @@ -126,7 +130,11 @@ End date of transactions to include in processing.
Filter transactions used in processing to payees that contain this string.
.It Fl \-period Ar STR
Split output into multiple results based on specified period. Valid options are:
.Sy Daily ,
.Sy Weekly ,
.Sy BiWeekly ,
.Sy Monthly ,
.Sy BiMonthly ,
.Sy Quarterly ,
.Sy SemiYearly ,
.Sy Yearly
Expand Down Expand Up @@ -165,7 +173,9 @@ match the
.Ar account-filter .
The purpose of this is to close the books for a period. The equity transaction
can be used as an inital transaction in a new file to start a new period. The
amount necessary to balance the transaction is assigned to the Equity account.
amount necessary to balance the transaction is assigned to the
.Sy Equity
account.
Options available for this command are:
.Bl -tag -compact -width "--begin-date (b) YYYY-mm-dd "
.It Fl \-begin-date ( Fl b ) Ar YYYY-mm-dd
Expand Down

0 comments on commit bfa5aa0

Please sign in to comment.