1#ifndef DBALLE_CMDLINE_CMDLINE_H
2#define DBALLE_CMDLINE_CMDLINE_H
10#include <dballe/file.h>
11#include <dballe/fwd.h>
23 std::vector<std::string> names;
31 virtual void add_to_optable(std::vector<poptOption>& opts)
const;
36 virtual int main(poptContext) = 0;
46 poptContext
make_popt_context(
int argc,
const char* argv[], std::vector<poptOption>& opts)
const;
47 void manpage_print_options(FILE* out);
50#define ODT_END { NULL, NULL, NULL, NULL, NULL, NULL }
57 std::string manpage_examples_section;
58 std::string manpage_files_section;
59 std::string manpage_seealso_section;
61 std::vector<Subcommand*> ops;
69 Subcommand* find_action(
const std::string& name)
const;
71 void usage(
const std::string& selfpath, FILE* out)
const;
72 void manpage(FILE* out)
const;
75 int main(
int argc,
const char* argv[]);
87 const char* what() const noexcept
override {
return msg.c_str(); }
103[[noreturn]]
void dba_cmdline_error(poptContext optCon, const
char* fmt, ...) __attribute__((format(printf, 2, 3))) ;
Query used to filter DB-All.e data.
Definition query.h:15
void dba_cmdline_print_dba_error()
Print informations about the last error to stderr.
unsigned dba_cmdline_get_query(poptContext optCon, Query &query)
Get a DB-ALLe query from commandline parameters in the form key=value.
std::list< std::string > get_filenames(poptContext optCon)
Read all the command line arguments and return them as a list.
void dba_cmdline_error(poptContext optCon, const char *fmt,...) __attribute__((format(printf
Print an error that happened when parsing commandline arguments, then add usage informations and exit...
void list_templates()
List available output templates.
void Encoding string_to_encoding(const char *type)
Return the File::Encoding that corresponds to the name in the string.
#define WREPORT_THROWF_ATTRS(a, b)
int main(int argc, const char *argv[])
Process commandline arguments and perform the action requested.
void add_subcommand(Subcommand *action)
Add an action to this tool, taking ownership of its memory management.
virtual void init()
Optional initialization before main is called.
poptContext make_popt_context(int argc, const char *argv[], std::vector< poptOption > &opts) const
Create a popt context for this subcommand.
Report an error with command line options.
Definition cmdline.h:80
static void throwf(const char *fmt,...) WREPORT_THROWF_ATTRS(1
Throw the exception, building the message printf-style.
error_cmdline(const std::string &msg)
Definition cmdline.h:84
std::string msg
error message returned by what()
Definition cmdline.h:81