Adds context summary, description and argument value descriptions. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/1644
-- Commit Summary --
* Improve CLI argument help
-- File Changes --
M src/libmain.c (12)
-- Patch Links --
https://github.com/geany/geany/pull/1644.patch https://github.com/geany/geany/pull/1644.diff
LGBI
@elextr can you test it, just requires inspecting `geany --help` after rebuild/reinstall.
As discussed might be nice if the text referred to the context eg "Use FILE as the libvte.so filename" but not essential.
As discussed might be nice if the text referred to the context eg "Use FILE as the libvte.so filename" but not essential.
Done.
b4n commented on this pull request.
Looks like I took a little too long reviewing, as you already got the same idea, but here are a few more places where it could be improved
@@ -119,17 +119,17 @@ static gboolean dummy = FALSE;
/* in alphabetical order of short options */ static GOptionEntry entries[] = { - { "column", 0, 0, G_OPTION_ARG_INT, &cl_options.goto_column, N_("Set initial column number for the first opened file (useful in conjunction with --line)"), NULL }, - { "config", 'c', 0, G_OPTION_ARG_FILENAME, &alternate_config, N_("Use an alternate configuration directory"), NULL }, + { "column", 0, 0, G_OPTION_ARG_INT, &cl_options.goto_column, N_("Set initial column number for the first opened file (useful in conjunction with --line)"), N_("COLUMN") }, + { "config", 'c', 0, G_OPTION_ARG_FILENAME, &alternate_config, N_("Use an alternate configuration directory"), N_("DIR") },
I would then try and include the placeholder in the description, like *Use alternate configuration directory DIR* or alike.
@@ -119,17 +119,17 @@ static gboolean dummy = FALSE;
/* in alphabetical order of short options */ static GOptionEntry entries[] = { - { "column", 0, 0, G_OPTION_ARG_INT, &cl_options.goto_column, N_("Set initial column number for the first opened file (useful in conjunction with --line)"), NULL }, - { "config", 'c', 0, G_OPTION_ARG_FILENAME, &alternate_config, N_("Use an alternate configuration directory"), NULL }, + { "column", 0, 0, G_OPTION_ARG_INT, &cl_options.goto_column, N_("Set initial column number for the first opened file (useful in conjunction with --line)"), N_("COLUMN") },
Same as below, maybe *Set initial column number to COLUMN for the first opened file (useful in conjunction with --line)*
{ "ft-names", 0, 0, G_OPTION_ARG_NONE, &ft_names, N_("Print internal filetype names"), NULL },
{ "generate-tags", 'g', 0, G_OPTION_ARG_NONE, &generate_tags, N_("Generate global tags file (see documentation)"), NULL }, { "no-preprocessing", 'P', 0, G_OPTION_ARG_NONE, &no_preprocessing, N_("Don't preprocess C/C++ files when generating tags file"), NULL }, #ifdef HAVE_SOCKET { "new-instance", 'i', 0, G_OPTION_ARG_NONE, &cl_options.new_instance, N_("Don't open files in a running instance, force opening a new instance"), NULL }, - { "socket-file", 0, 0, G_OPTION_ARG_FILENAME, &cl_options.socket_filename, N_("Use this socket filename for communication with a running Geany instance"), NULL }, + { "socket-file", 0, 0, G_OPTION_ARG_FILENAME, &cl_options.socket_filename, N_("Use this socket filename for communication with a running Geany instance"), N_("FILE") },
*Use socket filename FILE for communication with a running Geany instance*
{ "list-documents", 0, 0, G_OPTION_ARG_NONE, &cl_options.list_documents, N_("Return a list of open documents in a running Geany instance"), NULL },
#endif - { "line", 'l', 0, G_OPTION_ARG_INT, &cl_options.goto_line, N_("Set initial line number for the first opened file"), NULL }, + { "line", 'l', 0, G_OPTION_ARG_INT, &cl_options.goto_line, N_("Set initial line number for the first opened file"), N_("LINE") },
*Set initial line number to LINE for the first opened file*
@@ -140,7 +140,7 @@ static GOptionEntry entries[] =
{ "no-session", 's', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &cl_options.load_session, N_("Don't load the previous session's files"), NULL }, #ifdef HAVE_VTE { "no-terminal", 't', 0, G_OPTION_ARG_NONE, &no_vte, N_("Don't load terminal support"), NULL }, - { "vte-lib", 0, 0, G_OPTION_ARG_FILENAME, &lib_vte, N_("Filename of libvte.so"), NULL }, + { "vte-lib", 0, 0, G_OPTION_ARG_FILENAME, &lib_vte, N_("Filename of libvte.so"), N_("FILE") },
*Use FILE to provide libvte.so* (or something, I'm not too fond of that one right now)
b4n commented on this pull request.
@@ -140,7 +140,7 @@ static GOptionEntry entries[] =
{ "no-session", 's', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &cl_options.load_session, N_("Don't load the previous session's files"), NULL }, #ifdef HAVE_VTE { "no-terminal", 't', 0, G_OPTION_ARG_NONE, &no_vte, N_("Don't load terminal support"), NULL }, - { "vte-lib", 0, 0, G_OPTION_ARG_FILENAME, &lib_vte, N_("Filename of libvte.so"), NULL }, + { "vte-lib", 0, 0, G_OPTION_ARG_FILENAME, &lib_vte, N_("Use `FILE' as the dynamically-linked VTE library"), N_("FILE") },
I don't quite like <code>`'</code> quotes, can't we stick to `''` or `""`? (or here I don't even really feel the need for quotes at all, yet I guess it does make sense to have them)
b4n commented on this pull request.
@@ -535,6 +535,8 @@ static void parse_command_line_options(gint *argc, gchar ***argv)
context = g_option_context_new(_("[FILES...]"));
+ g_option_context_set_summary(context, _("A fast and lightweight IDE.")); + g_option_context_set_description(context, _("Report bugs to `https://github.com/geany/geany/issues'."));
same here
codebrainz commented on this pull request.
@@ -119,17 +119,17 @@ static gboolean dummy = FALSE;
/* in alphabetical order of short options */ static GOptionEntry entries[] = { - { "column", 0, 0, G_OPTION_ARG_INT, &cl_options.goto_column, N_("Set initial column number for the first opened file (useful in conjunction with --line)"), NULL }, - { "config", 'c', 0, G_OPTION_ARG_FILENAME, &alternate_config, N_("Use an alternate configuration directory"), NULL }, + { "column", 0, 0, G_OPTION_ARG_INT, &cl_options.goto_column, N_("Set initial column number for the first opened file (useful in conjunction with --line)"), N_("COLUMN") },
Done.
codebrainz commented on this pull request.
@@ -119,17 +119,17 @@ static gboolean dummy = FALSE;
/* in alphabetical order of short options */ static GOptionEntry entries[] = { - { "column", 0, 0, G_OPTION_ARG_INT, &cl_options.goto_column, N_("Set initial column number for the first opened file (useful in conjunction with --line)"), NULL }, - { "config", 'c', 0, G_OPTION_ARG_FILENAME, &alternate_config, N_("Use an alternate configuration directory"), NULL }, + { "column", 0, 0, G_OPTION_ARG_INT, &cl_options.goto_column, N_("Set initial column number for the first opened file (useful in conjunction with --line)"), N_("COLUMN") }, + { "config", 'c', 0, G_OPTION_ARG_FILENAME, &alternate_config, N_("Use an alternate configuration directory"), N_("DIR") },
Done.
codebrainz commented on this pull request.
{ "ft-names", 0, 0, G_OPTION_ARG_NONE, &ft_names, N_("Print internal filetype names"), NULL },
{ "generate-tags", 'g', 0, G_OPTION_ARG_NONE, &generate_tags, N_("Generate global tags file (see documentation)"), NULL }, { "no-preprocessing", 'P', 0, G_OPTION_ARG_NONE, &no_preprocessing, N_("Don't preprocess C/C++ files when generating tags file"), NULL }, #ifdef HAVE_SOCKET { "new-instance", 'i', 0, G_OPTION_ARG_NONE, &cl_options.new_instance, N_("Don't open files in a running instance, force opening a new instance"), NULL }, - { "socket-file", 0, 0, G_OPTION_ARG_FILENAME, &cl_options.socket_filename, N_("Use this socket filename for communication with a running Geany instance"), NULL }, + { "socket-file", 0, 0, G_OPTION_ARG_FILENAME, &cl_options.socket_filename, N_("Use this socket filename for communication with a running Geany instance"), N_("FILE") },
Done.
codebrainz commented on this pull request.
{ "list-documents", 0, 0, G_OPTION_ARG_NONE, &cl_options.list_documents, N_("Return a list of open documents in a running Geany instance"), NULL },
#endif - { "line", 'l', 0, G_OPTION_ARG_INT, &cl_options.goto_line, N_("Set initial line number for the first opened file"), NULL }, + { "line", 'l', 0, G_OPTION_ARG_INT, &cl_options.goto_line, N_("Set initial line number for the first opened file"), N_("LINE") },
Done.
codebrainz commented on this pull request.
@@ -140,7 +140,7 @@ static GOptionEntry entries[] =
{ "no-session", 's', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &cl_options.load_session, N_("Don't load the previous session's files"), NULL }, #ifdef HAVE_VTE { "no-terminal", 't', 0, G_OPTION_ARG_NONE, &no_vte, N_("Don't load terminal support"), NULL }, - { "vte-lib", 0, 0, G_OPTION_ARG_FILENAME, &lib_vte, N_("Filename of libvte.so"), NULL }, + { "vte-lib", 0, 0, G_OPTION_ARG_FILENAME, &lib_vte, N_("Filename of libvte.so"), N_("FILE") },
Done.
codebrainz commented on this pull request.
@@ -140,7 +140,7 @@ static GOptionEntry entries[] =
{ "no-session", 's', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &cl_options.load_session, N_("Don't load the previous session's files"), NULL }, #ifdef HAVE_VTE { "no-terminal", 't', 0, G_OPTION_ARG_NONE, &no_vte, N_("Don't load terminal support"), NULL }, - { "vte-lib", 0, 0, G_OPTION_ARG_FILENAME, &lib_vte, N_("Filename of libvte.so"), NULL }, + { "vte-lib", 0, 0, G_OPTION_ARG_FILENAME, &lib_vte, N_("Use `FILE' as the dynamically-linked VTE library"), N_("FILE") },
Done.
codebrainz commented on this pull request.
@@ -535,6 +535,8 @@ static void parse_command_line_options(gint *argc, gchar ***argv)
context = g_option_context_new(_("[FILES...]"));
+ g_option_context_set_summary(context, _("A fast and lightweight IDE.")); + g_option_context_set_description(context, _("Report bugs to `https://github.com/geany/geany/issues'."));
Done.
b4n commented on this pull request.
@@ -119,17 +119,17 @@ static gboolean dummy = FALSE;
/* in alphabetical order of short options */ static GOptionEntry entries[] = { - { "column", 0, 0, G_OPTION_ARG_INT, &cl_options.goto_column, N_("Set initial column number for the first opened file (useful in conjunction with --line)"), NULL }, - { "config", 'c', 0, G_OPTION_ARG_FILENAME, &alternate_config, N_("Use an alternate configuration directory"), NULL }, + { "column", 0, 0, G_OPTION_ARG_INT, &cl_options.goto_column, N_("Set initial column number to COLUMN for the first opened file (useful in conjunction with --line)"), N_("COLUMN") }, + { "config", 'c', 0, G_OPTION_ARG_FILENAME, &alternate_config, N_("Use an alternate configuration directory DIR"), N_("DIR") },
`s/an//`
codebrainz commented on this pull request.
@@ -119,17 +119,17 @@ static gboolean dummy = FALSE;
/* in alphabetical order of short options */ static GOptionEntry entries[] = { - { "column", 0, 0, G_OPTION_ARG_INT, &cl_options.goto_column, N_("Set initial column number for the first opened file (useful in conjunction with --line)"), NULL }, - { "config", 'c', 0, G_OPTION_ARG_FILENAME, &alternate_config, N_("Use an alternate configuration directory"), NULL }, + { "column", 0, 0, G_OPTION_ARG_INT, &cl_options.goto_column, N_("Set initial column number to COLUMN for the first opened file (useful in conjunction with --line)"), N_("COLUMN") }, + { "config", 'c', 0, G_OPTION_ARG_FILENAME, &alternate_config, N_("Use an alternate configuration directory DIR"), N_("DIR") },
Done.
b4n approved this pull request.
LGTM
WFM
Merged #1644.
github-comments@lists.geany.org