提交 30874b48 编写于 作者: B Behdad Esfahbod

[util] Make tools default to stdin if no text is provided

One less argument to type in typical testing workflow!
上级 20979511
...@@ -50,8 +50,10 @@ struct hb_view_t ...@@ -50,8 +50,10 @@ struct hb_view_t
if (argc && !input.text && !input.text_file) input.text = argv[0], argc--, argv++; if (argc && !input.text && !input.text_file) input.text = argv[0], argc--, argv++;
if (argc) if (argc)
fail (TRUE, "Too many arguments on the command line"); fail (TRUE, "Too many arguments on the command line");
if (!font_opts.font_file || (!input.text && !input.text_file)) if (!font_opts.font_file)
options.usage (); options.usage ();
if (!input.text && !input.text_file)
input.text_file = "-";
output.init (&font_opts); output.init (&font_opts);
......
...@@ -376,7 +376,7 @@ view_options_t::add_options (option_parser_t *parser) ...@@ -376,7 +376,7 @@ view_options_t::add_options (option_parser_t *parser)
parser->add_group (entries, parser->add_group (entries,
"view", "view",
"View options:", "View options:",
"Options controlling the output rendering", "Options controlling output rendering",
this); this);
} }
...@@ -391,7 +391,7 @@ shape_options_t::add_options (option_parser_t *parser) ...@@ -391,7 +391,7 @@ shape_options_t::add_options (option_parser_t *parser)
{"direction", 0, 0, G_OPTION_ARG_STRING, &this->direction, "Set text direction (default: auto)", "ltr/rtl/ttb/btt"}, {"direction", 0, 0, G_OPTION_ARG_STRING, &this->direction, "Set text direction (default: auto)", "ltr/rtl/ttb/btt"},
{"language", 0, 0, G_OPTION_ARG_STRING, &this->language, "Set text language (default: $LANG)", "langstr"}, {"language", 0, 0, G_OPTION_ARG_STRING, &this->language, "Set text language (default: $LANG)", "langstr"},
{"script", 0, 0, G_OPTION_ARG_STRING, &this->script, "Set text script (default: auto)", "ISO-15924 tag"}, {"script", 0, 0, G_OPTION_ARG_STRING, &this->script, "Set text script (default: auto)", "ISO-15924 tag"},
{"utf8-clusters", 0, 0, G_OPTION_ARG_NONE, &this->utf8_clusters, "Use UTF-8 byte indices, not char indices", NULL}, {"utf8-clusters", 0, 0, G_OPTION_ARG_NONE, &this->utf8_clusters, "Use UTF8 byte indices, not char indices", NULL},
{NULL} {NULL}
}; };
parser->add_group (entries, parser->add_group (entries,
...@@ -400,9 +400,7 @@ shape_options_t::add_options (option_parser_t *parser) ...@@ -400,9 +400,7 @@ shape_options_t::add_options (option_parser_t *parser)
"Options controlling the shaping process", "Options controlling the shaping process",
this); this);
const gchar *features_help = "\n" const gchar *features_help = "Comma-separated list of font features\n"
"\n"
" Comma-separated list of font features to apply to text\n"
"\n" "\n"
" Features can be enabled or disabled, either globally or limited to\n" " Features can be enabled or disabled, either globally or limited to\n"
" specific character ranges.\n" " specific character ranges.\n"
...@@ -444,7 +442,7 @@ shape_options_t::add_options (option_parser_t *parser) ...@@ -444,7 +442,7 @@ shape_options_t::add_options (option_parser_t *parser)
parser->add_group (entries2, parser->add_group (entries2,
"features", "features",
"Features options:", "Features options:",
"Options controlling the OpenType font features applied", "Options controlling font features used",
this); this);
} }
...@@ -470,7 +468,7 @@ text_options_t::add_options (option_parser_t *parser) ...@@ -470,7 +468,7 @@ text_options_t::add_options (option_parser_t *parser)
GOptionEntry entries[] = GOptionEntry entries[] =
{ {
{"text", 0, 0, G_OPTION_ARG_STRING, &this->text, "Set input text", "string"}, {"text", 0, 0, G_OPTION_ARG_STRING, &this->text, "Set input text", "string"},
{"text-file", 0, 0, G_OPTION_ARG_STRING, &this->text_file, "Set input text file-name", "filename"}, {"text-file", 0, 0, G_OPTION_ARG_STRING, &this->text_file, "Set input text file-name\n\n If no text is provided, standard input is used for input.", "filename"},
{NULL} {NULL}
}; };
parser->add_group (entries, parser->add_group (entries,
......
...@@ -239,7 +239,7 @@ struct text_options_t : option_group_t ...@@ -239,7 +239,7 @@ struct text_options_t : option_group_t
if (text && text_file) if (text && text_file)
g_set_error (error, g_set_error (error,
G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
"Only one of text and text-file must be set"); "Only one of text and text-file can be set");
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册