1
#ifndef DEBTAGS_OPTIONS_H
2
#define DEBTAGS_OPTIONS_H
5
* Commandline parser for tagcoll
7
* Copyright (C) 2003,2004,2005,2006 Enrico Zini
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
#include <tagcoll/Commandline.h>
27
namespace commandline {
29
struct DebtagsOptions : public MainParser<CommandParser>
31
struct HelpGroup : public OptionGroup
38
add(help = new BoolOption("help", 'h', "help"));
39
add(version = new BoolOption("version", 'V', "version"));
40
help->shortNames.push_back('?');
41
help->description = "print an help message and exit";
42
version->description = "print the program version and exit";
43
description = "Help options";
47
delete help; delete version;
51
struct OutputGroup : public OptionGroup
61
add(group = new BoolOption("group", 0, "group"));
62
add(quiet = new BoolOption("quiet", 'q', "quiet"));
63
add(names = new BoolOption("names", 0, "names"));
64
add(verbose = new BoolOption("verbose", 'v', "verbose"));
65
add(debug = new BoolOption("debug", 0, "debug"));
66
group->description = "group items with the same tagset in the output collection";
67
group->longNames.push_back("group-items");
68
quiet->description = "do not write anything to standard output";
69
names->description = "output only the names of the packages";
70
verbose->description = "enable verbose output";
71
debug->description = "enable debugging output (including verbose output)";
72
description = "Options controlling transformations of output data";
84
struct MatchGroup : public OptionGroup
90
add(invert = new BoolOption("invert", 'i', "invert"));
91
invert->description = "invert the match, selecting non-matching items";
92
description = "Options controlling matching of packages";
101
struct Generic : public OptionParser
103
Generic(DebtagsOptions* cp) : OptionParser("")
108
struct Help : public OptionParser
110
Help(DebtagsOptions* cp) : OptionParser("help")
113
description = "print help informations";
116
struct Update : public OptionParser
120
Update(DebtagsOptions* cp) : OptionParser("update")
122
add(local = new BoolOption("local", 0, "local"));
124
local->description = "do not download files when performing an update";
126
description = "updates the package tag database (requires root)";
128
"Collect package tag data from the sources listed in "
129
"/etc/debtags/sources.list, then regenerate the debtags "
130
"tag database and main index.\n"
131
"It needs to be run as root";
135
struct Selfcheck : public OptionParser
137
Selfcheck(DebtagsOptions* cp) : OptionParser("selfcheck")
140
description = "perform a series of internal self checks using the current tag data";
144
struct Check : public OptionParser
146
Check(DebtagsOptions* cp) : OptionParser("check")
150
"check that all the tags in the given tagged collection are present "
151
"in the tag vocabulary. Checks the main database if no file is "
156
struct Tagcat : public OptionParser
158
Tagcat(DebtagsOptions* cp) : OptionParser("tagcat")
161
description = "output the tag vocabulary";
165
struct Tagshow : public OptionParser
167
Tagshow(DebtagsOptions* cp) : OptionParser("tagshow")
170
description = "show the vocabulary informations about a tag";
174
struct Tagsearch : public OptionParser
176
Tagsearch(DebtagsOptions* cp) : OptionParser("tagsearch")
178
usage = "<string [string [string ...]]>";
179
description = "show a summary of all tags whose data contains the given strings";
183
struct Show : public OptionParser
185
Show(DebtagsOptions* cp) : OptionParser("show")
188
description = "show informations about a package, like apt-cache show does, but "
189
"adding the tag informations from the debtags index";
193
struct Related : public OptionParser
197
Related(DebtagsOptions* cp) : OptionParser("related")
199
add(distance = new IntOption("distance", 'd', "distance"));
200
distance->description = "set the maximum distance to use for the \"related\" command (defaults to 0)";
202
usage = "<pkg1[,pkg2[,pkg3...]]>";
203
description = "show packages related to the given one(s)";
205
"Output a list of the packages that are related to the given package or list of packages. "
206
"If more than one package are to be specified, separate them with commas.\n"
207
"The --distance option can be used to control how closely related the output "
208
"packages should be from the package(s) specified.";
209
examples = "debtags related mutt,mozilla-browser";
218
struct Cat : public OptionParser
220
Cat(DebtagsOptions* cp) : OptionParser("cat")
223
description = "output the full package tag database";
224
add(&cp->outputGroup);
228
struct Dumpavail : public OptionParser
230
Dumpavail(DebtagsOptions* cp) : OptionParser("dumpavail")
232
usage = "[tag expression]";
233
description = "output the full package database";
234
add(&cp->matchGroup);
238
struct Search : public OptionParser
240
Search(DebtagsOptions* cp) : OptionParser("search")
242
usage = "<tag expression>";
244
"output the names and descriptions of the packages that match"
245
"the given tag expression";
246
add(&cp->matchGroup);
250
struct Grep : public OptionParser
252
Grep(DebtagsOptions* cp) : OptionParser("grep")
254
usage = "<tag expression>";
256
"output the lines of the full package tag database that match"
257
"the given tag expression";
258
add(&cp->matchGroup);
259
add(&cp->outputGroup);
263
struct Install : public OptionParser
265
Install(DebtagsOptions* cp) : OptionParser("install")
267
usage = "<tag expression>";
269
"apt-get install the packages that match the given tag expression";
271
"Invokes apt-get install with the names of the packages matched "
272
"by the given tag expression. If you want to see what packages "
273
"would be installed you can use debtags search, as "
274
"debtags install just calls apt-get install on all "
275
"the results of an equivalent debtags search. Please note "
276
"that debtags install is just a prototype feature useful "
277
"for experimenting in some environments like Custom Debian "
278
"Distributions. For this reason it is suggested that you "
279
"use debtags just as a way to find packages, and "
280
"proper package managers as the way to install them";
281
add(&cp->matchGroup);
285
struct Diff : public OptionParser
287
Diff(DebtagsOptions* cp) : OptionParser("diff")
289
usage = "[filename]";
291
"create a tag patch between the current tag database and the tag"
292
"collection [filename]. Standard input is used if filename is not specified";
295
aliases.push_back("mkpatch");
298
struct Maintainers : public OptionParser
300
Maintainers(DebtagsOptions* cp) : OptionParser("maintainers")
304
"create a tagged collection of maintainers and the tags of the"
305
"packages they maintain";
306
add(&cp->outputGroup);
310
struct Tag : public OptionParser
312
Tag(DebtagsOptions* cp) : OptionParser("tag")
314
usage = "{add|rm|ls} <package> [tags...]";
315
description = "view and edit the tags for a package";
317
"General manipulation of tags, useful for automation in scripts.\n"
318
"It can be used in three ways:\n"
319
"tag add <package> <tags...> will add the tags to the given package\n"
320
"tag rm <package> <tags...> will remove the tags from the given package\n"
321
"tag ls <package> will output the names of the tags of the given package";
325
struct Submit : public OptionParser
327
Submit(DebtagsOptions* cp) : OptionParser("submit")
331
"mail the given patch file to the central tag repository."
332
"If [patch] is omitted, mail the local tag modifications.";
336
struct Todo : public OptionParser
338
Todo(DebtagsOptions* cp) : OptionParser("todo")
341
description = "print a list of the installed packages that are not yet tagged";
345
struct Score : public OptionParser
347
Score(DebtagsOptions* cp) : OptionParser("score")
351
"score uninstalled packages according to how often their tags "
352
"appear in the packages that are installed already";
356
struct Facetcoll : public OptionParser
358
Facetcoll(DebtagsOptions* cp) : OptionParser("facetcoll")
362
"print the tagged collection where each package is tagged with"
363
"its facets only. Useful for further processing via tagcoll";
364
add(&cp->outputGroup);
368
struct Stats : public OptionParser
370
Stats(DebtagsOptions* cp) : OptionParser("stats")
373
description = "print statistics about Debtags";
377
struct Todoreport : public OptionParser
379
Todoreport(DebtagsOptions* cp) : OptionParser("todoreport")
382
description = "print a report of packages needing work";
386
struct SmartSearch : public OptionParser
388
SmartSearch(DebtagsOptions* cp) : OptionParser("smartsearch")
390
usage = "<word [word1 [+tag [-tag1 ...]]]>";
392
"Perform a keyword search integrated with related packages.\n"
393
"A + prefix indicates a wanted tag. A - prefix indicates "
394
"an unwanted tag. Other words indicate keywords to search.\n"
395
"Remember to use '--' before unwanted tags to avoid to have "
396
"them interpreted as commandline switches.\n";
401
DebtagsOptions() : MainParser<CommandParser>("debtags"),
402
generic(this), help(this), update(this), selfcheck(this), check(this),
403
tagcat(this), tagshow(this), tagsearch(this), show(this),
404
related(this), cat(this), dumpavail(this), search(this), grep(this), install(this),
405
diff(this), maintainers(this), tag(this), submit(this), todo(this),
406
score(this), facetcoll(this), stats(this), todoreport(this),
435
usage = "<command> [options and arguments]";
436
description = "Commandline interface to access and manipulate Debian Package Tags";
443
// vim:set ts=4 sw=4: