aboutsummaryrefslogtreecommitdiff
path: root/fiv.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-04-17 07:17:16 +0200
committerPřemysl Eric Janouch <p@janouch.name>2023-04-17 07:20:07 +0200
commita6560509d99d75728c0c857de4859ca9d81f1a0d (patch)
treecce8b3ac6ce32318dba60e3dac636d63a13c2a7f /fiv.c
parent44c28f00d65ace6ea6ef340de03139f98648ebe5 (diff)
downloadfiv-a6560509d99d75728c0c857de4859ca9d81f1a0d.tar.gz
fiv-a6560509d99d75728c0c857de4859ca9d81f1a0d.tar.xz
fiv-a6560509d99d75728c0c857de4859ca9d81f1a0d.zip
Revise documentation and help output
Split out clearly internal options.
Diffstat (limited to 'fiv.c')
-rw-r--r--fiv.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/fiv.c b/fiv.c
index d6beebf..d74bce3 100644
--- a/fiv.c
+++ b/fiv.c
@@ -2172,32 +2172,46 @@ main(int argc, char *argv[])
const GOptionEntry options[] = {
{G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &args,
NULL, "[PATH | URI]..."},
- {"list-supported-media-types", 0, G_OPTION_FLAG_IN_MAIN,
- G_OPTION_ARG_NONE, &show_supported_media_types,
- "Output supported media types and exit", NULL},
{"browse", 0, G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_NONE, &browse,
"Start in filesystem browsing mode", NULL},
- {"thumbnail-for-search", 0, G_OPTION_FLAG_IN_MAIN,
- G_OPTION_ARG_STRING, &thumbnail_size_search,
- "Output an image file suitable for searching by content", "SIZE"},
- {"extract-thumbnail", 0, G_OPTION_FLAG_IN_MAIN,
- G_OPTION_ARG_NONE, &extract_thumbnail,
- "Output any embedded thumbnail (superseding --thumbnail)", NULL},
- {"thumbnail", 0, G_OPTION_FLAG_IN_MAIN,
- G_OPTION_ARG_STRING, &thumbnail_size,
- "Generate thumbnails, up to SIZE, and output that size", "SIZE"},
{"invalidate-cache", 0, G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_NONE, &invalidate_cache,
"Invalidate the wide thumbnail cache", NULL},
+ {"list-supported-media-types", 0, G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_NONE, &show_supported_media_types,
+ "Output supported media types and exit", NULL},
{"version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
&show_version, "Output version information and exit", NULL},
{},
};
+ const GOptionEntry options_internal[] = {
+ {"extract-thumbnail", 0, 0,
+ G_OPTION_ARG_NONE, &extract_thumbnail,
+ "Output any embedded thumbnail (superseding --thumbnail)", NULL},
+ {"thumbnail", 0, 0,
+ G_OPTION_ARG_STRING, &thumbnail_size,
+ "Generate thumbnails, up to SIZE, and output that size", "SIZE"},
+ {"thumbnail-for-search", 0, 0,
+ G_OPTION_ARG_STRING, &thumbnail_size_search,
+ "Output an image file suitable for searching by content", "SIZE"},
+ {},
+ };
+
+ GOptionContext *context =
+ g_option_context_new(" - Image browser and viewer");
+ g_option_context_add_group(context, gtk_get_option_group(TRUE));
+ g_option_context_add_main_entries(context, options, NULL);
+
+ GOptionGroup *internals = g_option_group_new(
+ "internal", "Internal Options:", "Show internal options", NULL, NULL);
+ g_option_group_add_entries(internals, options_internal);
+ g_option_context_add_group(context, internals);
GError *error = NULL;
- gboolean initialized = gtk_init_with_args(
- &argc, &argv, " - Image browser and viewer", options, NULL, &error);
+ gboolean initialized =
+ g_option_context_parse(context, &argc, &argv, &error);
+ g_option_context_free(context);
if (show_version) {
const char *version = PROJECT_VERSION;
printf("%s %s\n", PROJECT_NAME, &version[*version == 'v']);