Introduce select-mode and use pretty formating for the global lists.
[adu.git] / select.ggo
1
2 option "uid" u
3 #~~~~~~~~~~~~~
4 "user id(s) to take into account"
5 string typestr="uid_spec"
6 optional
7 details="
8 An uid specifier may be a single number, or a range of uids.
9 Example:
10
11 --uid 42 # only consider uid 42
12 --uid 42- # only consider uids greater or equal than 42
13 --uid 23-42 # only consider uids between 23 and 42, inclusively.
14 --uid 23-42,666-777,88 # consider uids 23-42, 666-777 and 88.
15 "
16
17 option "limit" L
18 #~~~~~~~~~~~~~~~
19 "Limit output"
20 int typestr="num"
21 default="-1"
22 optional
23 details="
24 Only print num lines of output. If negative (the default),
25 print all lines.
26 "
27
28 option "no-headers" -
29 #~~~~~~~~~~~~~~~~~~~~
30 "supress descriptions for listings/tables"
31 flag off
32 details="
33 This is mostly useful to feed the output of adu to scripts.
34 "
35
36 option "select-mode" m
37 #~~~~~~~~~~~~~~~~~~~~~
38 "How to print the results of the query"
39 enum typestr="<key>"
40 values="global_list","global_summary","user_list","user_summary"
41 default="global_list"
42 optional
43 details="
44 global_list: List of directories, regardless of owner.
45 global_summary: Only print totals.
46 user_list: Print a list for each admissible uid.
47 user_summary Print totals for each admissible uid.
48 "
49
50 option "sort" s
51 #~~~~~~~~~~~~~~~
52 "how to sort the output"
53 enum typestr="<key>"
54 values="sizes","files","unsorted"
55 default="sizes"
56 optional
57 details="
58 Sort by file size, file count or unsorted.
59 "
60
61 option "output" o
62 #~~~~~~~~~~~~~~~~
63 "file to write output to"
64 string typestr="<path>"
65 optional
66 default="-"
67 details="
68 If empty, or not given, use stdout.
69 "
70
71 option "size-unit" -
72 #~~~~~~~~~~~~~~~~~~~
73 "select output format for sizes"
74 enum typestr="format"
75 values="h","b","k","m","g","t"
76 default="h"
77 optional
78 details="
79 Print sizes in the given unit: human-readable, bytes,
80 kilobytes (2^10), megabytes (2^20), gigabytes (2^30), terabytes
81 (2^40). The default is \"h\", i.e. human-readable.
82 "
83
84 option "count-unit" -
85 #~~~~~~~~~~~~~~~~~~~~
86 "select output format for counted values"
87 enum typestr="format"
88 values="h","n","k","m","g","t"
89 default="h"
90 optional
91 details="
92 Print the number of files/directories in the given unit:
93 human-readable, number, number/10^3, number/10^6, number/10^12,
94 number/10^15. The default is to print numbers in human-readable
95 format.
96 "
97
98
99 option "user-summary-sort" -
100 #~~~~~~~~~~~~~~~~~~~~~~~~~~~
101 "how to sort the user-summary"
102 enum typestr="col_spec"
103 values="name","uid","dir_count","file_count","size"
104 default="size"
105 optional
106 details="
107 It is enough to specify the first letter of the column specifier,
108 e.g. \"--user-summary-sort f\" sorts by file count.
109 "
110
111 option "no-user-summary" -
112 #~~~~~~~~~~~~~~~~~~~~~~~~~~~
113 "do not print the user summary table"
114 flag off
115
116
117 option "user-list" -
118 #~~~~~~~~~~~~~~~~~~~
119 "how to print per-user directory listings"
120 enum typestr="which"
121 values="size","file_count","both","none"
122 default="both"
123 optional
124 details="
125 Similar to the global directory listings mentioned above,
126 adu can print two directory listings per user. This option
127 controls which of the these should be printed.
128 "
129 option "no-global-summary" -
130 #~~~~~~~~~~~~~~~~~~~~~~~~~~~
131 "do not print the summary line"
132 flag off
133
134 option "global-list" -
135 #~~~~~~~~~~~~~~~~~~~~~
136 "how to print global directory listings"
137 enum typestr="which"
138 values="size","file_count","both","none"
139 default="both"
140 optional
141 details="
142 By default adu prints two global directory listings: The
143 first prints the directory names ordered by the sum of the
144 sizes of the contained files while the second listing prints
145 them sorted by the number of files. This option can be used
146 to print only one or neither of these two listings.
147 "
148 option "print-base-dir" -
149 #~~~~~~~~~~~~~~~~~~~~~~~~
150 "whether to include the base-dir in the output"
151 flag off
152 details="
153 If this flag is given, all directories printed are prefixed
154 with the base directory. The default is to print paths relative
155 to the base dir.
156 "
157
158 ########################
159 section "Format strings"
160 ########################
161
162 option "global-list-format" -
163 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
164 "How to format the global list"
165 string typestr="<format>"
166 default="%(size:r:8) %(files:r:8) %(dirname)\n"
167 details="
168 size: Total size of all files
169 files: The number of files
170 dirname: The name of the directory
171 "
172
173 optional
174 option "global-summary-format" -
175 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176 "How to format the global summary"
177 string typestr="<format>"
178 default="#directories: %(dirs), #files: %(files), size: %(size)\n\n"
179 details="
180 dirs: The number of directories
181 files: The number of files
182 size: Total size of all files
183 "
184 optional
185
186 option "user-summary-format" -
187 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188 "How to format the user summary"
189 string typestr="<format>"
190 default="%(pw_name:l:16) %(uid:r:5) %(dirs:r:5) %(files:r:5) %(size:r:5)\n"
191 details="
192 pw_name: The user name
193 uid: The user id
194 dirs: The number of directories
195 files: The number of files
196 size: Total size of all files
197 "
198 optional