forked from tn47/goledger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmdoptions.go
54 lines (50 loc) · 931 Bytes
/
cmdoptions.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package api
import (
"fmt"
"os"
"time"
)
var _ = fmt.Sprintf("dummy")
var Options struct {
Dbname string
Journals []string
Currentdt string
Begindt *time.Time
Enddt *time.Time
Finyear int
Period string
Nosubtotal bool
Subtotal bool
Cleared bool
Uncleared bool
Pending bool
Dcformat bool
Strict bool
Pedantic bool
Checkpayee bool
Stitch bool
Nopl bool
Onlypl bool
Detailed bool
Bypayee bool
Daily bool
Weekly bool
Monthly bool
Quarterly bool
Yearly bool
Dow bool
Verbose bool
Outfd *os.File
Loglevel string
}
func FilterPeriod(date time.Time, nobegin bool) bool {
begin, end := Options.Begindt, Options.Enddt
if nobegin == false && begin != nil && date.Before(*begin) {
return false
} else if end != nil && date.Before(*end) {
return true
} else if end == nil {
return true
}
return false
}