[util] List supported output formats in --help output
This commit is contained in:
parent
f95a87b7b8
commit
9815a88111
|
@ -31,7 +31,8 @@
|
||||||
struct output_buffer_t
|
struct output_buffer_t
|
||||||
{
|
{
|
||||||
output_buffer_t (option_parser_t *parser)
|
output_buffer_t (option_parser_t *parser)
|
||||||
: options (parser),
|
: options (parser,
|
||||||
|
g_strjoinv (" / ", (gchar**) hb_buffer_serialize_list_formats ())),
|
||||||
format (parser) {}
|
format (parser) {}
|
||||||
|
|
||||||
void init (const font_options_t *font_opts)
|
void init (const font_options_t *font_opts)
|
||||||
|
@ -49,8 +50,7 @@ struct output_buffer_t
|
||||||
{
|
{
|
||||||
if (options.explicit_output_format)
|
if (options.explicit_output_format)
|
||||||
fail (false, "Unknown output format `%s'; supported formats are: %s",
|
fail (false, "Unknown output format `%s'; supported formats are: %s",
|
||||||
options.output_format,
|
options.output_format, options.supported_formats);
|
||||||
g_strjoinv (" / ", (gchar**) hb_buffer_serialize_list_formats ()));
|
|
||||||
else
|
else
|
||||||
/* Just default to TEXT if not explicitly requested and the
|
/* Just default to TEXT if not explicitly requested and the
|
||||||
* file extension is not recognized. */
|
* file extension is not recognized. */
|
||||||
|
|
|
@ -246,7 +246,7 @@ stdio_write_func (void *closure,
|
||||||
return CAIRO_STATUS_SUCCESS;
|
return CAIRO_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char helper_cairo_supported_formats[] =
|
const char helper_cairo_supported_formats[] =
|
||||||
"ansi"
|
"ansi"
|
||||||
#ifdef CAIRO_HAS_PNG_FUNCTIONS
|
#ifdef CAIRO_HAS_PNG_FUNCTIONS
|
||||||
"/png"
|
"/png"
|
||||||
|
|
|
@ -36,6 +36,7 @@ cairo_scaled_font_t *
|
||||||
helper_cairo_create_scaled_font (const font_options_t *font_opts,
|
helper_cairo_create_scaled_font (const font_options_t *font_opts,
|
||||||
double font_size);
|
double font_size);
|
||||||
|
|
||||||
|
extern const char helper_cairo_supported_formats[];
|
||||||
|
|
||||||
cairo_t *
|
cairo_t *
|
||||||
helper_cairo_create_context (double w, double h,
|
helper_cairo_create_context (double w, double h,
|
||||||
|
|
|
@ -367,10 +367,17 @@ text_options_t::add_options (option_parser_t *parser)
|
||||||
void
|
void
|
||||||
output_options_t::add_options (option_parser_t *parser)
|
output_options_t::add_options (option_parser_t *parser)
|
||||||
{
|
{
|
||||||
|
const char *text;
|
||||||
|
|
||||||
|
if (NULL == supported_formats)
|
||||||
|
text = "Set output format";
|
||||||
|
else
|
||||||
|
text = g_strdup_printf ("Set output format\n\n Supported formats are: %s", supported_formats);
|
||||||
|
|
||||||
GOptionEntry entries[] =
|
GOptionEntry entries[] =
|
||||||
{
|
{
|
||||||
{"output-file", 0, 0, G_OPTION_ARG_STRING, &this->output_file, "Set output file-name (default: stdout)","filename"},
|
{"output-file", 0, 0, G_OPTION_ARG_STRING, &this->output_file, "Set output file-name (default: stdout)","filename"},
|
||||||
{"output-format", 0, 0, G_OPTION_ARG_STRING, &this->output_format, "Set output format", "format"},
|
{"output-format", 0, 0, G_OPTION_ARG_STRING, &this->output_format, text, "format"},
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
parser->add_group (entries,
|
parser->add_group (entries,
|
||||||
|
|
|
@ -310,9 +310,11 @@ struct text_options_t : option_group_t
|
||||||
|
|
||||||
struct output_options_t : option_group_t
|
struct output_options_t : option_group_t
|
||||||
{
|
{
|
||||||
output_options_t (option_parser_t *parser) {
|
output_options_t (option_parser_t *parser,
|
||||||
|
const char *supported_formats_ = NULL) {
|
||||||
output_file = NULL;
|
output_file = NULL;
|
||||||
output_format = NULL;
|
output_format = NULL;
|
||||||
|
supported_formats = supported_formats_;
|
||||||
explicit_output_format = false;
|
explicit_output_format = false;
|
||||||
|
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
|
@ -345,6 +347,7 @@ struct output_options_t : option_group_t
|
||||||
|
|
||||||
const char *output_file;
|
const char *output_file;
|
||||||
const char *output_format;
|
const char *output_format;
|
||||||
|
const char *supported_formats;
|
||||||
bool explicit_output_format;
|
bool explicit_output_format;
|
||||||
|
|
||||||
mutable FILE *fp;
|
mutable FILE *fp;
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
struct view_cairo_t {
|
struct view_cairo_t {
|
||||||
view_cairo_t (option_parser_t *parser)
|
view_cairo_t (option_parser_t *parser)
|
||||||
: output_options (parser),
|
: output_options (parser, helper_cairo_supported_formats),
|
||||||
view_options (parser) {}
|
view_options (parser) {}
|
||||||
~view_cairo_t (void) {
|
~view_cairo_t (void) {
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|
Loading…
Reference in New Issue