depends: revert to functional style
[aurutils.git] / man1 / aur-format.1
blob36743f23ca1af3d73050370ec5ae68fce5a42cb2
1 .TH AUR\-FORMAT 1 2022-10-20 AURUTILS
2 .SH NAME
3 aur\-format \- format AurJson output to text strings
5 .SH SYNOPSIS
6 .SY "aur format"
7 .OP \-f format
8 .OP \-d delim
9 .OP \-v
10 .RI [ file ... ]
11 .SY "aur format"
12 .OP \-\-gron
13 .RI [ file ... ]
14 .YS
16 .SH DESCRIPTION
17 .B aur\-format
18 takes JSON responses as input and transforms them into shell-readable output, using
19 .BR sprintf (3)
20 like formats.
21 .PP
22 Suitable inputs include
23 .BR aur\-query (1),
24 .BR aur\-pkglist (1)
25 and
26 .BR aur\-repo\-parse (1).
28 .SH OPTIONS
29 .TP
30 .BI \-f " FORMAT" "\fR,\fP \-\-format=" FORMAT
31 The character
32 .B %
33 is followed by one of the following flags, corresponding to a package
34 field. If the field is an array, it is expanded with the delimiter
35 defined with
36 .BR \-\-delim .
37 .IP
38 .B a
39 Arch
40 .IP
41 .B b
42 PackageBase
43 .IP
44 .B c
45 CheckDepends (array)
46 .IP
47 .B C
48 Conflicts (array)
49 .IP
50 .B d
51 Description
52 .IP
53 .B D
54 Depends (array)
55 .IP
56 .B e
57 License (array)
58 .IP
59 .B g
60 Groups (array)
61 .IP
62 .B M
63 MakeDepends (array)
64 .IP
65 .B n
66 Name
67 .IP
68 .B O
69 OptDepends (array)
70 .IP
71 .B P
72 Provides (array)
73 .IP
74 .B U
75 URL
76 .IP
77 .B v
78 Version
79 .IP
80 .B f
81 FileName
82 .IP
83 .B F
84 Files
85 .IP
86 .B r
87 DBPath
88 .IP
89 .B R
90 Repository
91 .IP
92 .B K
93 Keywords (array)
94 .IP
95 .B L
96 LastModified
97 .IP
98 .B m
99 Maintainer
101 .B o
102 OutOfDate
104 .B p
105 Popularity
107 .B S
108 FirstSubmitted
110 .B w
111 NumVotes
114 .BI \-d " SEP" "\fR,\fP \-\-delim=" SEP
115 The delimiter for expanding arrays. Defaults to a single space.
118 .BR \-\-gron
119 Format output similar to
120 .BR gron (1).
123 .BR \-v ", " \-\-verbose
124 If a field is empty, replace it with a hyphen.
126 .SH EXIT STATUS
127 The exit status is
128 .B 0
129 if input was formatted correctly,
130 .B 1
131 if an invalid option was specified,
132 .B 2
133 if an input file is not found, and
134 .B 4
135 on invalid or erroneous input (i.e. the input includes an
136 .B error
137 attribute).
139 .SH EXAMPLES
140 .B aur\-format
141 can be used with
142 .BR aur\-pkglist (1)
143 if information is not available from the aurweb RPC interface. For
144 example, package searches can be done by name and description, but not
145 by description only.
147 The following code demonstrates this by providing a list of all packages with
148 .I AUR
150 .I Arch User Repository
151 (case-insensitive) in their description. Any duplicate descriptions are
152 removed from the results.
155     aur pkglist \-i | aur format \-f '%n\\t%d\\n' |
156         gawk \-F'\\t' 'tolower($2) ~ /(aur|arch user repository)\\>/ { print }' |
157         sort \-k2,2 -t $'\\t' \-u |
158         sort \-k1,1
161 When searching orphaned packages, an empty maintainer search with
162 .B aur search \-m ""
163 should, by definition, give the desired results. However, with a results
164 limit of 5000 the aurweb RPC interface returns an
165 .B Too many package results
166 error. We can again resort to
167 .BR aur\-pkglist (1):
170     aur pkglist \-\-info | aur format \-f "%n\\t%m\\n" \-v |
171         gawk \-F'\\t' "{ if ($2 != '-') print $1; }"
174 In case only a limited set of targets is needed,
175 .B aur pkglist \-\-info
176 can be replaced with
177 .BR "aur pkglist <pattern> | aur query \-t info" .
179 .SH SEE ALSO
180 .BR aur\-search (1),
181 .BR aur\-depends (1),
182 .BR aur\-repo\-parse (1),
183 .BR aur\-pkglist (1),
184 .BR aur\-query (1)
186 .SH AUTHORS
187 .MT https://github.com/AladW
188 Alad Wenter
191 .\" vim: set textwidth=72: