Skip to content

Commit 52d59c3

Browse files
authored
Feature: Rename date fields (date -> updated; build-date -> built) (#349)
1 parent 45ca94e commit 52d59c3

24 files changed

Lines changed: 597 additions & 219 deletions

File tree

README.md

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ more ecosystems are added every week!
6868
* query packages using an expressive query language
6969
* supports full boolean logic (`and`, `or`, `not`, grouping)
7070
* supports fuzzy and strict matching
71-
* supports range queries for `size`, `date`, and `build-date`
71+
* supports range queries for `size`, `updated`, and `built`
7272
* supports presence/absence checks (`has:`, `no:`)
7373
* learn more about querying [here](#querying-with-where)
7474
* sort results by any field
@@ -79,7 +79,7 @@ more ecosystems are added every week!
7979
* query by:
8080
* name, version, origin, architecture, license
8181
* size on disk
82-
* install or build date
82+
* update or build time/date
8383
* package base or groups
8484
* dependencies, optional dependencies, reverse dependencies
8585
* package provisions, conflicts, replacements
@@ -266,16 +266,9 @@ qp [command] [args] [options]
266266
- use `select all,version` to list default fields + version
267267
- [see fields available for selection](#available-fields)
268268
- `where <query>` | `w <query>`: apply one or more queries to refine package results.
269-
- supported query types:
270-
- **string match** -> `field=value` (fuzzy) or `field==value` (strict)
271-
- **range match** -> `field=start:end` (fuzzy) or `field==start:end` (strict)
272-
- supports full ranges (`start:end`), open-ended ranges (`start:` or `:end`), and exact values (`value`)
273-
- works with `date` and `size`
274-
- **existence check** -> `has:field` or `no:field`
275-
- use `and`, `or`, `not`, `q ... p` to build complex filters
276269
- learn more about querying [here](#querying-with-where)
277270
- `order <field>:<direction>` | `o <field>:<direction>`: sort results ascending or descending
278-
- default sort is `date:asc`
271+
- default sort is `updated:asc`
279272
- `limit <number>` | `l <number>`: limit the amount of packages to display (default: 20)
280273
- `limit all` | `l all`: display all packages
281274
- `limit end:<number>`: display last `n` packages
@@ -284,7 +277,7 @@ qp [command] [args] [options]
284277
### options
285278

286279
- `--no-headers`: omit column headers in table output (useful for scripting)
287-
- `--full-timestamp`: display the full timestamp (date and time) of package install/build instead of just the date
280+
- `--full-timestamp`: display the full timestamp (date and time) of package update/build instead of just the date
288281
- `--output`: format output as `table`, `kv` (key-value), `json` (default:`table`)
289282
- `--no-progress`: force no progress bar outside of non-interactive environments
290283
- `--no-cache`: disable cache loading/saving and force fresh package data loading
@@ -293,8 +286,8 @@ qp [command] [args] [options]
293286

294287
### available fields
295288

296-
- `date` - installation date of the package
297-
- `build-date` - date the package was built
289+
- `updated` - when the package was last updated
290+
- `built` - when the package was built
298291
- `size` - package size on disk
299292
- `name` - package name
300293
- `reason` - installation reason (explicit/dependency)
@@ -372,7 +365,7 @@ each `where` query supports one of the following:
372365
- **range match**
373366
- `field=start:end` -> fuzzy match
374367
- `field==start:end` -> strict match
375-
- works with `date` and `size`
368+
- works with `updated`, `built`, and `size`
376369
- supports:
377370
- full ranges: `start:end`
378371
- open-ended ranges: `start:` or `:end`
@@ -471,7 +464,7 @@ qp w not superorphan and not name=gtk
471464
qp w name==bash and has:depends
472465
qp where size=100MB:2GB
473466
qp w name=python,cmake,yazi
474-
qp w date==2024-01-01
467+
qp w updated==2024-01-01
475468
qp where q name=vim or name=nvim p and not has:conflicts
476469
qp w not arch=x86_64
477470
qp w q has:depends or has:required-by p and not reason=explicit
@@ -489,8 +482,8 @@ qp w q has:depends or has:required-by p and not reason=explicit
489482

490483
| field name | field type |
491484
|------------|------------|
492-
| date | range |
493-
| build-date | range |
485+
| updated | range |
486+
| built | range |
494487
| size | range |
495488
| name | string |
496489
| reason | string |
@@ -614,7 +607,7 @@ output format:
614607
- multiple short commands are supported using space separation (e.g. `s`, `w`, `l`, `o`), but **cannot** be combined as `swo` or `-swo`. use them like this:
615608
```
616609
qp w name yay
617-
qp s name,size w name=vim o date:asc l 10 # full query with shorthand
610+
qp s name,size w name=vim o updated:asc l 10 # full query with shorthand
618611
```
619612

620613
- group queries with `q ... p` to clarify order of operations:
@@ -630,8 +623,8 @@ output format:
630623

631624
- options that take arguments can be used in the `--<option>=<value>` form:
632625
```
633-
qp select name,date --limit=100
634-
qp s name,date o name
626+
qp select name,updated --limit=100
627+
qp s name,updated o name
635628
```
636629

637630
boolean flags can be explicitly set using `--<option>=true` or `--<option>=false`:
@@ -664,9 +657,9 @@ output format:
664657
qp where reason=explicit limit all
665658
```
666659

667-
3. show only dependencies installed on a specific date
660+
3. show only dependencies updated on a specific date
668661
```
669-
qp where reason=dependency and date=2025-03-01
662+
qp where reason=dependency and update=2025-03-01
670663
```
671664

672665
4. show all packages sorted alphabetically by name
@@ -681,7 +674,7 @@ output format:
681674

682675
6. show packages installed between January 1, 2025, and January 5, 2025
683676
```
684-
qp where date=2025-01-01:2025-01-05
677+
qp where updated=2025-01-01:2025-01-05
685678
```
686679

687680
7. sort all packages by their license, displaying name and license
@@ -696,12 +689,12 @@ output format:
696689

697690
9. show packages between 100MB and 1GB installed up to February 27, 2025
698691
```
699-
qp where size=100MB:1GB and date=:2025-02-27
692+
qp where size=100MB:1GB and updated=:2025-02-27
700693
```
701694

702695
10. show all packages sorted by size in descending order, installed after January 1, 2025
703696
```
704-
qp where date=2025-01-01: order size:desc limit all
697+
qp where updated=2025-01-01: order size:desc limit all
705698
```
706699

707700
11. search for installed packages containing "python"
@@ -716,12 +709,12 @@ output format:
716709

717710
13. search for packages with names containing "linux" installed between January 1 and March 30, 2025
718711
```
719-
qp where name=linux and date=2025-01-01:2025-03-30
712+
qp where name=linux and updated=2025-01-01:2025-03-30
720713
```
721714

722715
14. search for packages containing "gtk" installed after January 1, 2025, and at least 5MB in size
723716
```
724-
qp where name=gtk and date=2025-01-01: and size=5MB:
717+
qp where name=gtk and updated=2025-01-01: and size=5MB:
725718
```
726719

727720
15. show packages with name, version, and size
@@ -781,7 +774,7 @@ output format:
781774

782775
26. show packages required by `vlc` and installed after January 1, 2025
783776
```
784-
qp where required-by=vlc and date=2025-01-01:
777+
qp where required-by=vlc and updated=2025-01-01:
785778
```
786779

787780
27. show all packages that have `glibc` as a dependency and are required by `ffmpeg`

internal/config/help.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Commands:
1818
1919
where <query> | w <query> Refine package results using one or more queries
2020
- Supports: field=value, field==value
21-
- Range: date=2024-01-01:2024-01-10
21+
- Range: updated=2024-01-01:2024-01-10
2222
- Existence: has:depends, no:conflicts
2323
- Depth: depends=package@2, required-by=pkg@3
2424
@@ -37,13 +37,13 @@ Query Types:
3737
field=value -> fuzzy match (e.g., name=gtk)
3838
field==value -> exact match (e.g., name==bash)
3939
40-
- Range match (date, size):
40+
- Range match (dates, sizes):
4141
field=start:end -> fuzzy match
4242
field==start:end -> exact match
4343
Examples:
4444
size=10MB:1GB
45-
date==2024-01-01
46-
date=2024-01-01: (open-ended range)
45+
updated==2024-01-01
46+
updated=2024-01-01: (open-ended range)
4747
4848
- Existence check:
4949
has:field -> field must exist or be non-empty
@@ -83,7 +83,7 @@ Match Behavior:
8383
strict = exact byte size
8484
8585
Short Command Examples:
86-
qp s name,size w name=vim o date:asc l 10
86+
qp s name,size w name=vim o updated:asc l 10
8787
qp where name=gtk
8888
qp w name==bash
8989
qp w reason=explicit and size=50MB:

internal/config/legacy_query_parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func convertLegacyQueries(
6363
) []query.FieldQuery {
6464
if dateFilter != "" {
6565
queries = append(queries, query.FieldQuery{
66-
Field: consts.FieldDate,
66+
Field: consts.FieldUpdated,
6767
Target: dateFilter,
6868
Match: consts.MatchFuzzy,
6969
})

internal/consts/fields.go

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ const (
1717
FieldUrl
1818
FieldGroups
1919
FieldSize
20-
FieldDate
21-
FieldBuildDate
20+
FieldUpdated
21+
FieldBuilt
2222
FieldVersion
2323
FieldDepends
2424
FieldOptDepends
@@ -30,8 +30,8 @@ const (
3030
)
3131

3232
const (
33-
date = "date"
34-
buildDate = "build-date"
33+
updated = "updated"
34+
built = "built"
3535
size = "size"
3636
name = "name"
3737
reason = "reason"
@@ -56,21 +56,23 @@ const (
5656
)
5757

5858
var FieldTypeLookup = map[string]FieldType{
59-
"d": FieldDate,
59+
"u": FieldUpdated,
6060
"n": FieldName,
6161
"r": FieldReason,
6262
"s": FieldSize,
6363
"v": FieldVersion,
6464
"D": FieldDepends,
6565
"R": FieldRequiredBy,
6666
"p": FieldProvides,
67-
"bd": FieldBuildDate,
67+
"bd": FieldBuilt,
6868
"type": FieldPkgType,
6969

70-
"alphabetical": FieldName, // legacy flag, to be deprecated
70+
"date": FieldUpdated, // legacy field
71+
"build-date": FieldBuilt, // legacy field
72+
"alphabetical": FieldName, // legacy flag, to be deprecated
7173

72-
date: FieldDate,
73-
buildDate: FieldBuildDate,
74+
updated: FieldUpdated,
75+
built: FieldBuilt,
7476
size: FieldSize,
7577
name: FieldName,
7678
reason: FieldReason,
@@ -95,8 +97,8 @@ var FieldTypeLookup = map[string]FieldType{
9597
}
9698

9799
var FieldNameLookup = map[FieldType]string{
98-
FieldDate: date,
99-
FieldBuildDate: buildDate,
100+
FieldUpdated: updated,
101+
FieldBuilt: built,
100102
FieldSize: size,
101103
FieldName: name,
102104
FieldReason: reason,
@@ -122,15 +124,15 @@ var FieldNameLookup = map[FieldType]string{
122124

123125
var (
124126
DefaultFields = []FieldType{
125-
FieldDate,
127+
FieldUpdated,
126128
FieldName,
127129
FieldReason,
128130
FieldSize,
129131
}
130132
// note: this is also the order the columns will be displayed in table output
131133
ValidFields = []FieldType{
132-
FieldDate,
133-
FieldBuildDate,
134+
FieldUpdated,
135+
FieldBuilt,
134136
FieldSize,
135137
FieldName,
136138
FieldReason,
@@ -180,7 +182,7 @@ var RelationFields = map[FieldType]struct{}{
180182
}
181183

182184
var RangeFields = map[FieldType]struct{}{
183-
FieldDate: {},
184-
FieldBuildDate: {},
185-
FieldSize: {},
185+
FieldUpdated: {},
186+
FieldBuilt: {},
187+
FieldSize: {},
186188
}

internal/display/render_json.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,29 @@ import (
1010
)
1111

1212
type PkgInfoJSON struct {
13-
InstallTimestamp int64 `json:"installTimestamp,omitempty"`
14-
BuildTimestamp int64 `json:"buildTimestamp,omitempty"`
15-
Size int64 `json:"size,omitempty"`
16-
Name string `json:"name,omitempty"`
17-
Reason string `json:"reason,omitempty"`
18-
Version string `json:"version,omitempty"`
19-
Origin string `json:"origin,omitempty"`
20-
Arch string `json:"arch,omitempty"`
21-
License string `json:"license,omitempty"`
22-
Description string `json:"description,omitempty"`
23-
Url string `json:"url,omitempty"`
24-
Validation string `json:"validation,omitempty"`
25-
PkgType string `json:"pkgtype,omitempty"`
26-
PkgBase string `json:"pkgbase,omitempty"`
27-
Packager string `json:"packager,omitempty"`
28-
Groups []string `json:"groups,omitempty"`
29-
Conflicts []string `json:"conflicts,omitempty"`
30-
Replaces []string `json:"replaces,omitempty"`
31-
Depends []string `json:"depends,omitempty"`
32-
OptDepends []string `json:"optDepends,omitempty"`
33-
RequiredBy []string `json:"requiredBy,omitempty"`
34-
OptionalFor []string `json:"optionalFor,omitempty"`
35-
Provides []string `json:"provides,omitempty"`
13+
UpdateTimestamp int64 `json:"updateTimestamp,omitempty"`
14+
BuildTimestamp int64 `json:"buildTimestamp,omitempty"`
15+
Size int64 `json:"size,omitempty"`
16+
Name string `json:"name,omitempty"`
17+
Reason string `json:"reason,omitempty"`
18+
Version string `json:"version,omitempty"`
19+
Origin string `json:"origin,omitempty"`
20+
Arch string `json:"arch,omitempty"`
21+
License string `json:"license,omitempty"`
22+
Description string `json:"description,omitempty"`
23+
Url string `json:"url,omitempty"`
24+
Validation string `json:"validation,omitempty"`
25+
PkgType string `json:"pkgtype,omitempty"`
26+
PkgBase string `json:"pkgbase,omitempty"`
27+
Packager string `json:"packager,omitempty"`
28+
Groups []string `json:"groups,omitempty"`
29+
Conflicts []string `json:"conflicts,omitempty"`
30+
Replaces []string `json:"replaces,omitempty"`
31+
Depends []string `json:"depends,omitempty"`
32+
OptDepends []string `json:"optDepends,omitempty"`
33+
RequiredBy []string `json:"requiredBy,omitempty"`
34+
OptionalFor []string `json:"optionalFor,omitempty"`
35+
Provides []string `json:"provides,omitempty"`
3636
}
3737

3838
func (o *OutputManager) renderJSON(pkgPtrs []*pkgdata.PkgInfo, fields []consts.FieldType) {
@@ -82,9 +82,9 @@ func getJsonValues(pkg *pkgdata.PkgInfo, fields []consts.FieldType) *PkgInfoJSON
8282

8383
for _, field := range fields {
8484
switch field {
85-
case consts.FieldDate:
86-
filteredPackage.InstallTimestamp = pkg.GetInt(field)
87-
case consts.FieldBuildDate:
85+
case consts.FieldUpdated:
86+
filteredPackage.UpdateTimestamp = pkg.GetInt(field)
87+
case consts.FieldBuilt:
8888
filteredPackage.BuildTimestamp = pkg.GetInt(field)
8989
case consts.FieldSize:
9090
filteredPackage.Size = pkg.GetInt(field)

internal/display/render_table.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ type tableContext struct {
1414
}
1515

1616
var columnHeaders = map[consts.FieldType]string{
17-
consts.FieldDate: "DATE",
18-
consts.FieldBuildDate: "BUILD DATE",
17+
consts.FieldUpdated: "UPDATED",
18+
consts.FieldBuilt: "BUILT",
1919
consts.FieldName: "NAME",
2020
consts.FieldReason: "REASON",
2121
consts.FieldSize: "SIZE",
@@ -100,7 +100,7 @@ func renderRows(
100100

101101
func getTableValue(pkg *pkgdata.PkgInfo, field consts.FieldType, ctx tableContext) string {
102102
switch field {
103-
case consts.FieldDate, consts.FieldBuildDate:
103+
case consts.FieldUpdated, consts.FieldBuilt:
104104
return formatDate(pkg.GetInt(field), ctx)
105105

106106
case consts.FieldSize:

0 commit comments

Comments
 (0)