-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
format strings for library and xbps-query #542
base: master
Are you sure you want to change the base?
Conversation
8b4daae
to
f84b587
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
.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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah i see pkgname in the manpage now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approval for concept and (user-facing) functionality
bin/xbps-query/xbps-query.1
Outdated
@@ -100,6 +100,8 @@ Ignore repositories defined in configuration files. | |||
Only repositories specified in the command line via | |||
.Ar --repository | |||
will be used. | |||
.It Fl J, Fl -json | |||
Print output as json. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: