You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: klog/app/cli/args/filter.go
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -11,10 +11,10 @@ import (
11
11
12
12
typeFilterArgsstruct {
13
13
// Date-related filters:
14
-
Date klog.Date`name:"date" placeholder:"DATE" group:"Filter Flags:" help:"Entries at this date. DATE has to be in format YYYY-MM-DD or YYYY/MM/DD. E.g., '2024-01-31' or '2024/01/31'."`
15
-
Since klog.Date`name:"since" placeholder:"DATE" group:"Filter Flags:" help:"Entries since this date (inclusive)."`
16
-
Until klog.Date`name:"until" placeholder:"DATE" group:"Filter Flags:" help:"Entries until this date (inclusive)."`
17
-
Period period.Period`name:"period" placeholder:"PERIOD" group:"Filter Flags:" help:"Entries within a calendar period. PERIOD has to be in format YYYY, YYYY-MM, YYYY-Www or YYYY-Qq. E.g., '2024', '2024-04', '2022-W21' or '2024-Q1'."`
14
+
Date klog.Date`name:"date" placeholder:"DATE" group:"Filter Flags:" help:"Records at this date. DATE has to be in format YYYY-MM-DD or YYYY/MM/DD. E.g., '2024-01-31' or '2024/01/31'."`
15
+
Since klog.Date`name:"since" placeholder:"DATE" group:"Filter Flags:" help:"Records since this date (inclusive)."`
16
+
Until klog.Date`name:"until" placeholder:"DATE" group:"Filter Flags:" help:"Records until this date (inclusive)."`
17
+
Period period.Period`name:"period" placeholder:"PERIOD" group:"Filter Flags:" help:"Records within a calendar period. PERIOD has to be in format YYYY, YYYY-MM, YYYY-Www or YYYY-Qq. E.g., '2024', '2024-04', '2022-W21' or '2024-Q1'."`
18
18
19
19
// Filter shortcuts:
20
20
// The two `XXX` ones are dummy entries just for the help output, they also aren’t available
Tags []klog.Tag`name:"tag" placeholder:"TAG" group:"Filter Flags:" help:"Entries that match these tags (either in the record summary or the entry summary). You can omit the leading '#'."`
38
-
Filterstring`name:"filter" placeholder:"EXPR" group:"Filter Flags:" help:"Entries that match this filter expression. Run 'klog info --filtering' to learn how expressions works."`
37
+
Tags []klog.Tag`name:"tag" placeholder:"TAG" group:"Filter Flags:" help:"Records or entries that match these tags (either in the record summary or the entry summary). You can omit the leading '#'."`
38
+
Filterstring`name:"filter" placeholder:"EXPR" group:"Filter Flags:" help:"Records or entries that match this filter expression. Run 'klog info --filtering' to learn how expressions works."`
39
39
40
40
hasPartialRecordsWithShouldTotalbool// Field only for internal use
41
41
singleShortHandFilter period.Period// Field only for internal use
klog total --filter='2025-04 && #work' mytimes.klg
27
27
28
-
This would evaluate all entries in April 2025 that match the tag #work. Wrap the filter expression in single quotes to avoid undesired shell word splitting or substitution. Filter expressions consist of operands for matching the data that shall be included in the filter result. Operands can be combined via logical operators and grouped via parentheses.
28
+
This would evaluate all records and entries in April 2025 that match the tag #work. Wrap the filter expression in single quotes to avoid undesired shell word splitting or substitution. Filter expressions consist of operands for matching the data that shall be included in the filter result. Operands can be combined via logical operators and grouped via parentheses.
29
+
30
+
Filters can match at record-level and/or at entry-level. It only keeps the data that satisfies the filter condition. For entry-level filters, this means that all non-matching entries are stripped from the record.
Outputs data on the terminal, by default with syntax-highlighting turned on.
26
26
Note that the output doesn’t resemble the file verbatim, but it may apply some minor formatting.
27
27
28
-
If run with filter flags, it only outputs those entries that match the filter clauses. E.g., when filtering for a tag that only appears particular entries, it will exclude all other entries from that record.
29
-
30
28
You can optionally also sort the records, or print out the total times for each record and entry.
0 commit comments