Skip to content

Commit aab32fe

Browse files
committed
bin/xbps-query: update/clean format documentation
1 parent 28fe8de commit aab32fe

File tree

1 file changed

+68
-42
lines changed

1 file changed

+68
-42
lines changed

bin/xbps-query/xbps-query.1

Lines changed: 68 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -89,48 +89,10 @@ If the first character is not '/' then it's a relative path of
8989
.It Fl d, Fl -debug
9090
Enables extra debugging shown to stderr.
9191
.It Fl F, Fl -format Ar format
92-
Format for list output.
93-
.Bd -literal
94-
<substitution> ::= "{" variable ["!" conversion] [":" format] "}"
95-
<variable> ::= [a-zA-Z90-9_-]
96-
97-
<conversion> ::= humanize | strmode
98-
99-
-- Convert inode status information into a symbolic string
100-
<strmode> ::= "strmode"
101-
102-
-- Format a number into a human readable form, the default is:`humanize .8Ki`:
103-
<humanize> ::= "humanize" [space] [decimal] [width] [scale] [i]
104-
<space> ::= " " -- Put a space between number and the suffix.
105-
<decimal> ::= "." -- If the final result is less than 10, display
106-
it using one digit.
107-
<width> ::= [0-9]+ -- Width of the output.
108-
<scale> ::= multiplier -- Minimum scale multiplier and optionally
109-
[multiplier] -- Maxium scale multiplier.
110-
<multiplier> ::= "B"
111-
| "K" -- kilo
112-
| "M" -- mega
113-
| "G" -- giga
114-
| "T" -- tera
115-
| "P" -- peta
116-
| "E" -- exa
117-
<i> ::= "i" -- Divide number with 1000 instead of 1024.
118-
119-
<format> ::= [[fill] align] [sign] [width] ["." precision] [type]
120-
<fill> ::= <any char> -- The character to use when aligning the output.
121-
<align> ::= "<" -- Left align.
122-
| ">" -- Right align.
123-
| "=" -- Left align with zero paddings after the sign.
124-
<sign> ::= "+" -- Add sign to positive and negative numbers.
125-
| "-" -- Add sign to negative numbers.
126-
<width> ::= [0-9]+ -- The alignment width.
127-
<precision> ::= [0-9]+ -- Percision for numbers.
128-
<type> ::= "d" -- Decimal number.
129-
| "o" -- Octal number.
130-
| "u" -- Unsigned number.
131-
| "x" -- Hexadecimal with lowercase letters.
132-
| "X" -- Hexadecimal with uppercase letters.
133-
.Ed
92+
Format string for output formatting.
93+
See
94+
.Sx FORMAT STRINGS
95+
for syntax.
13496
.It Fl h, Fl -help
13597
Show the help message.
13698
.It Fl i, Fl -ignore-conf-repos
@@ -320,6 +282,70 @@ expression wins.
320282
This expects an absolute path.
321283
This mode only works with repositories.
322284
.El
285+
.Sh FORMAT STRINGS
286+
Variables are package properties if not otherwise documented.
287+
See
288+
.Sx PROPERTIES
289+
section for a list of available properties.
290+
.Pp
291+
As example a format string like:
292+
.Bd -offset indent -literal
293+
{pkgname:<30} {installed_size!humanize :>10}\\n
294+
.Ed
295+
.Pp
296+
Would produce a list formatted like:
297+
.Bd -offset indent -literal
298+
libxbps 304 KB
299+
xbps 484 KB
300+
.Ed
301+
.Pp
302+
Format strings are parsed by the following EBNF:
303+
.Bd -literal
304+
<grammar> ::= (text | escape | substitution)*
305+
<text> ::= [^\\{}]+ -- literal text chunk
306+
<escape> ::= "\\" [abfnrtv0] -- POSIX-like espace sequence
307+
| "\\{" | "\\}" -- escaped "{" and "}"
308+
309+
<substitution> ::= "{" variable ["!" conversion] [":" format] "}"
310+
<variable> ::= [a-zA-Z0-9_-]
311+
312+
<conversion> ::= humanize | strmode
313+
314+
-- Convert inode status information into a symbolic string
315+
<strmode> ::= "strmode"
316+
317+
-- Format a number into a human readable form, the default is:`humanize .8Ki`:
318+
<humanize> ::= "humanize" [space] [decimal] [width] [scale] [i]
319+
<space> ::= " " -- Put a space between number and the suffix.
320+
<decimal> ::= "." -- If the final result is less than 10, display
321+
it using one digit.
322+
<width> ::= [0-9]+ -- Width of the output.
323+
<scale> ::= multiplier -- Minimum scale multiplier and optionally
324+
[multiplier] -- Maxium scale multiplier.
325+
<multiplier> ::= "B"
326+
| "K" -- kilo
327+
| "M" -- mega
328+
| "G" -- giga
329+
| "T" -- tera
330+
| "P" -- peta
331+
| "E" -- exa
332+
<i> ::= "i" -- Divide number with 1000 instead of 1024.
333+
334+
<format> ::= [[fill] align] [sign] [width] ["." precision] [type]
335+
<fill> ::= <any char> -- The character to use when aligning the output.
336+
<align> ::= "<" -- Left align.
337+
| ">" -- Right align.
338+
| "=" -- Left align with zero paddings after the sign.
339+
<sign> ::= "+" -- Add sign to positive and negative numbers.
340+
| "-" -- Add sign to negative numbers.
341+
<width> ::= [0-9]+ -- The alignment width.
342+
<precision> ::= [0-9]+ -- Percision for numbers.
343+
<type> ::= "d" -- Decimal number.
344+
| "o" -- Octal number.
345+
| "u" -- Unsigned number.
346+
| "x" -- Hexadecimal with lowercase letters.
347+
| "X" -- Hexadecimal with uppercase letters.
348+
.Ed
323349
.Sh PROPERTIES
324350
This is the list of a packages properties.
325351
Note that not all properties are available for all packages.

0 commit comments

Comments
 (0)