File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,16 @@ class FilterCommand : CliktCommand("filter") {
45
45
help = " Remove all booking item whose info matches the given regular expression."
46
46
)
47
47
48
+ private val lessOrEqual by option(
49
+ " --less-or-equal" ,
50
+ help = " Only include bookings that are less or equal to the given amount."
51
+ )
52
+
53
+ private val greaterOrEqual by option(
54
+ " --greater-or-equal" ,
55
+ help = " Only include bookings that are greater or equal to the given amount."
56
+ )
57
+
48
58
private val statements by requireObject<Set <Statement >>()
49
59
50
60
override fun run () {
@@ -62,6 +72,8 @@ class FilterCommand : CliktCommand("filter") {
62
72
.filterNot { typeNot == it.type }
63
73
.filter { filterRegex?.containsMatchIn(it.info.joinInfo()) != false }
64
74
.filterNot { filterNotRegex?.containsMatchIn(it.info.joinInfo()) == true }
75
+ .filter { lessOrEqual?.toFloat()?.let { threshold -> it.amount <= threshold } != false }
76
+ .filter { greaterOrEqual?.toFloat()?.let { threshold -> it.amount >= threshold } != false }
65
77
66
78
filteredBookings.forEach {
67
79
println (" ${it.valueDate} : ${it.type} : ${" %.2f" .format(it.amount)} " )
You can’t perform that action at this time.
0 commit comments