format strings for library and xbps-query#542
format strings for library and xbps-query#542Duncaen wants to merge 32 commits intovoid-linux:masterfrom
Conversation
8b4daae to
f84b587
Compare
classabbyamp
left a comment
There was a problem hiding this comment.
interested in this for #541
035ac3d to
89a1704
Compare
This comment was marked as outdated.
This comment was marked as outdated.
74f6346 to
aab32fe
Compare
|
this seems backwards to me? MiB would be the powers of 2 Mebibytes and MB would be the 10s based megabytes |
Yes that was wrong, changed to:
|
| .Pp | ||
| As example a format string like: | ||
| .Bd -offset indent -literal | ||
| {pkgname:<30} {installed_size!humanize :>10}\\n |
There was a problem hiding this comment.
is pkgname a property? if not, would it be possible to have it (and maybe version?) as a "pre-filtered" pkgver?
There was a problem hiding this comment.
pkgname is added by xbps "dynamically" at runtime, which kinda sucks but we could probably do that for version too.
There was a problem hiding this comment.
ah i see pkgname in the manpage now
There was a problem hiding this comment.
maybe have {pkgver!pkgname} and {pkgver!version} or something like that, nut sure if this really matters, maybe I should just change this in the documentation to pkgver.
There was a problem hiding this comment.
well pkgname is listed in PROPERTIES, so it should be fine. adding version as a dynamic property is fairly minor imo, so could be done later.
There was a problem hiding this comment.
Main issue with the pkgname prop is that for the pkgdb it is added when the pkgdb is loaded, for packages out of repodata it sets it when you use xbps_repo_get_pkg, so this may not be set for certain cases where it iterates of the packages in the repo.
I think xtraeme added this as a hack because the code converted pkgvers to pkgnames all over the place.
|
feature request for this: default values. would be useful for e.g. printing the user/group. maybe the syntax could be |
b080bf3 to
02f7bcd
Compare
|
Some form of replacement on values is needed to produce machine-readable output. Maybe separate argument, like |
e52683e to
0a47ba2
Compare
classabbyamp
left a comment
There was a problem hiding this comment.
approval for concept and (user-facing) functionality
bin/xbps-query/xbps-query.1
Outdated
| .Ar --repository | ||
| will be used. | ||
| .It Fl J, Fl -json | ||
| Print output as json. |
There was a problem hiding this comment.
would be good to indicate which operating modes --json and --format work in (or get it working in all operating modes)
looks like currently it works for:
-J |
-F |
|
|---|---|---|
-l |
x | x |
-L |
||
-H |
x | x |
--list-repolock-pkgs |
x | x |
-m |
x | x |
-o |
||
-S |
||
-s |
||
-f |
1 | 1 |
-x |
||
-X |
Footnotes
-
no but I think track file mode and ownership in files.plist #541 will cover it ↩ ↩2
an incantation like this can create invalid json (hacky I know). I think all that needs adding is a default for arrays? |
I'm not final on the api, don't really like the function names but couldn't come up with anything better.
Format strings are inspired by pythons
f""strings: