Add options for selecting what to print.
[adu.git] / adu.ggo
1 # Copyright (C) 2008 Andre Noll <maan@systemlinux.org>
2 #
3 # Licensed under the GPL v2. For licencing details see COPYING.
4
5 package "adu"
6 version "0.0.1"
7 purpose "advanced disk usage
8
9 adu creates a database containing disk usage statistics of a given
10 directory. It allows to query that database to quickly retrieve
11 usage patterns of subdirectories and/or files owned by a given user id.
12 "
13
14 #########################
15 section "General options"
16 #########################
17
18 option "config-file" c
19 #~~~~~~~~~~~~~~~~~~~~~
20 "(default='~/.adurc')"
21 string typestr="filename"
22 optional
23 details="
24 Options may be given at the command line or in the
25 configuration file. As usual, if an option is given both at
26 the command line and in the configuration file, the command
27 line option takes precedence.
28
29 "
30
31 option "database-dir" d
32 #~~~~~~~~~~~~~~~~~~~~~~
33 "directory containing the osl tables"
34 string typestr="path"
35 required
36 details="
37 Full path to the directory containing the osl tables. This
38 directory must exist. It must be writable for the user running
39 adu in --create mode and readable in --select mode.
40
41 "
42 option "loglevel" l
43 #~~~~~~~~~~~~~~~~~~
44 "Set loglevel (0-6)"
45 int typestr="level"
46 default="3"
47 optional
48 details="
49 Log messages are always written to stderr while normal output
50 goes to stdout. Lower values mean more verbose logging.
51 "
52
53 option "uid" u
54 #~~~~~~~~~~~~~
55 "user id(s) to take into account"
56 string typestr="uid_spec"
57 optional
58 multiple
59 details="
60 An uid specifier may be a single number, or a range of uids.
61 Example:
62
63 --uid 42 # only consider uid 42
64 --uid 42- # only consider uids greater or equal than 42
65 --uid 23-42 # only consider uids between 23 and 42, inclusively.
66
67 This option may be given multiple times. An uid is taken into
68 account if it satisfies at least one --uid option.
69 "
70
71
72 option "paths" p
73 #~~~~~~~~~~~~~~~
74 "files to take into account"
75 string typestr="pattern"
76 optional
77 details="
78 Shell wildcard pattern that must match a file in order to be
79 included in the database in --create mode or in the output
80 for --select mode. Only the part of the filename below the
81 base directory is matched against the pattern. The default
82 is to take all files into account. See fnmatch(3) for details.
83 "
84
85 ###############
86 section "Modes"
87 ###############
88
89 defgroup "mode"
90 #==============
91 groupdesc="
92 adu may be started in one of two possible modes, each of which
93 corresponds to a different command line option. Exactly one
94 of these options must be given.
95
96 "
97 required
98
99 groupoption "create" C
100 #~~~~~~~~~~~~~~~~~~~~~
101 "Create a new database"
102 group="mode"
103 details="
104 Traverse the given directory and track disk user on a per-user
105 basis. Results are stored in N + 1 osl tables where N is
106 the number of uids that own at least one regular file in
107 that directory.
108 "
109
110 groupoption "select" S
111 #~~~~~~~~~~~~~~~~~~~~~
112 "query a database previously created with --create"
113 group="mode"
114 details="
115 This option prints statistics about matching subdirectories to
116 stdout. The output depends on the other options, see below.
117 "
118
119 ##############################
120 section "Options for --create"
121 ##############################
122
123 option "base-dir" b
124 #~~~~~~~~~~~~~~~~~~
125 "directory to traverse"
126 string typestr="path"
127 dependon="create"
128 optional
129 details="
130 The base directory to be traversed recursively. Must be
131 given if --create mode was selected. A warning message is
132 printed for each subdirectory that could not be read because
133 of insufficient permission. These directories will be ignored
134 when computing statistics.
135 "
136
137 option "one-file-system" x
138 #~~~~~~~~~~~~~~~~~~~~~~~~~
139 "do not dive into other file systems"
140 flag off
141 dependon="create"
142 details="
143 Skip directories that are on different filesystems from the
144 one that the argument being processed is on.
145 "
146
147 option "hash-table-bits" -
148 #~~~~~~~~~~~~~~~~~~~~~~~~~
149 "specify the size of the uid hash table"
150 int typestr="num"
151 dependon="create"
152 default="10"
153 optional
154 details="
155 Use a hash table of size 2^num for the uid entries. If more than
156 2^num different uids own at least one regular file under base-dir,
157 the command fails. Increase this value if you have more than 1024
158 users. Decreasing the value causes adu to use slightly less memory.
159 "
160
161
162 ##############################
163 section "Options for --select"
164 ##############################
165
166 option "limit" L
167 #~~~~~~~~~~~~~~~
168 "Limit output"
169 int typestr="num"
170 default="-1"
171 optional
172 dependon="select"
173 details="
174 Only print num lines of output. If negative (the default),
175 print all lines.
176 "
177
178 option "size-unit" -
179 #~~~~~~~~~~~~~~~~~~~
180 "select output format for sizes"
181 enum typestr="format"
182 values="h","b","k","m","g","t"
183 default="h"
184 optional
185 dependon="select"
186 details="
187 Print sizes in the given unit: human-readable, bytes,
188 kilobytes (2^10), megabytes (2^20), gigabytes (2^30), terabytes
189 (2^40). The default is \"h\", i.e. human-readable.
190 "
191
192 option "count-unit" -
193 #~~~~~~~~~~~~~~~~~~~~
194 "select output format for counted values"
195 enum typestr="format"
196 values="h","n","k","m","g","t"
197 default="h"
198 optional
199 dependon="select"
200 details="
201 Print the number of files/directories in the given unit:
202 human-readable, number, number/10^3, number/10^6, number/10^12,
203 number/10^15. The default is to print numbers in human-readable
204 format.
205 "
206
207 option "no-headers" -
208 #~~~~~~~~~~~~~~~~~~~~
209 "supress descriptions for listings/tables"
210 flag off
211 dependon="select"
212 details="
213 This is mostly useful to feed the output of adu to scripts.
214 "
215
216 option "global-list" -
217 #~~~~~~~~~~~~~~~~~~~~~
218 "how to print global directory listings"
219 enum typestr="which"
220 values="size","file_count","both","none"
221 default="both"
222 optional
223 dependon="select"
224 details="
225 By default adu prints two global directory listings: The
226 first prints the directory names ordered by the sum of the
227 sizes of the contained files while the second listing prints
228 them sorted by the number of files. This option can be used
229 to print only one or neither of these two listings.
230 "
231
232 option "no-global-summary" -
233 #~~~~~~~~~~~~~~~~~~~~~~~~~~~
234 "do not print the summary line"
235 flag off
236 dependon="select"
237
238 option "user-list" -
239 #~~~~~~~~~~~~~~~~~~~
240 "how to print per-user directory listings"
241 enum typestr="which"
242 values="size","file_count","both","none"
243 default="both"
244 optional
245 dependon="select"
246 details="
247 Similar to the global directory listings mentioned above,
248 adu can print two directory listings per user. This option
249 controls which of the these should be printed.
250 "
251
252 option "no-user-summary" -
253 #~~~~~~~~~~~~~~~~~~~~~~~~~~~
254 "do not print the user summary table"
255 flag off
256 dependon="select"
257
258
259 option "user-summary-sort" -
260 #~~~~~~~~~~~~~~~~~~~~~~~~~~~
261 "how to sort the user-summary"
262 enum typestr="col_spec"
263 values="name","uid","dir_count","file_count","size"
264 default="size"
265 optional
266 dependon="select"
267 details="
268 It is enough to specify the first letter of the column specifier,
269 e.g. \"--user-summary-sort f\" sorts by file count.
270 "