View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0003577 | GNUnet | util library | public | 2014-12-14 04:28 | 2018-06-07 00:25 |
| Reporter | cy1 | Assigned To | Christian Grothoff | ||
| Priority | normal | Severity | feature | Reproducibility | N/A |
| Status | closed | Resolution | fixed | ||
| Product Version | Git master | ||||
| Target Version | 0.11.0pre66 | Fixed in Version | 0.11.0pre66 | ||
| Summary | 0003577: gnunet-config needs to be able to list what available sections there are | ||||
| Description | gnunet-config requires you specify the --section argument, which isn't much help for a user who can't run the fancy graphical gnunet-setup program to find out even what sections there are. It really needs to support a --list-sections option, and probably should list available sections, or even dump the whole known config, when called without arguments. | ||||
| Tags | No tags attached. | ||||
| Attached Files | 3577.patch (1,616 bytes)
Index: src/util/gnunet-config.c
===================================================================
--- src/util/gnunet-config.c (revision 35003)
+++ src/util/gnunet-config.c (working copy)
@@ -48,6 +48,11 @@
static int is_filename;
/**
+ * Whether to show the sections.
+ */
+static int list_sections;
+
+/**
* Return value from 'main'.
*/
static int ret;
@@ -72,6 +77,20 @@
/**
+ * Print out given section name.
+ *
+ * @param cls unused
+ * @param section a section in the configuration file
+ */
+static void
+print_section_name (void *cls,
+ const char *section)
+{
+ fprintf (stdout, "%s\n", section);
+}
+
+
+/**
* Main function that will be run by the scheduler.
*
* @param cls closure
@@ -85,9 +104,14 @@
{
struct GNUNET_CONFIGURATION_Handle *out;
- if (NULL == section)
+ if (NULL == section || list_sections)
{
- fprintf (stderr, _("--section argument is required\n"));
+ if (! list_sections)
+ {
+ fprintf (stderr, _("--section argument is required\n"));
+ }
+ fprintf (stderr, _("The following sections are available:\n"));
+ GNUNET_CONFIGURATION_iterate_sections (cfg, &print_section_name, NULL);
ret = 1;
return;
}
@@ -168,6 +192,9 @@
{ 'V', "value", "VALUE",
gettext_noop ("value to set"),
1, &GNUNET_GETOPT_set_string, &value },
+ { 'S', "list-sections", NULL,
+ gettext_noop ("print available configuration sections"),
+ 0, &GNUNET_GETOPT_set_one, &list_sections },
GNUNET_GETOPT_OPTION_END
};
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
3577.doc.patch (643 bytes)
Index: doc/man/gnunet-config.1 =================================================================== --- doc/man/gnunet-config.1 (revision 35003) +++ doc/man/gnunet-config.1 (working copy) @@ -19,6 +19,9 @@ .IP "\-s SECTION, \-\-section=SECTION" Which configuration section should be accessed or edited. Required option. .B +.IP "\-S, \-\-list\-sections" +List available configuration sections for use with \-\-section. +.B .IP "\-o OPTION, \-\-option=OPTION" Which configuration option should be accessed or edited. Required to set a value. If not given, all values of a given section will be printed in the format "OPTION = VALUE". .B | ||||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2014-12-14 04:28 | cy1 | New Issue | |
| 2014-12-14 12:32 | Christian Grothoff | Note Added: 0008683 | |
| 2014-12-14 12:32 | Christian Grothoff | Status | new => confirmed |
| 2015-01-26 00:22 | hellekin | File Added: 3577.patch | |
| 2015-01-26 00:48 | hellekin | File Added: 3577.doc.patch | |
| 2015-01-26 20:25 | Christian Grothoff | Note Added: 0008810 | |
| 2015-01-26 20:25 | Christian Grothoff | Status | confirmed => resolved |
| 2015-01-26 20:25 | Christian Grothoff | Fixed in Version | => 0.11.0pre66 |
| 2015-01-26 20:25 | Christian Grothoff | Resolution | open => fixed |
| 2015-01-26 20:25 | Christian Grothoff | Assigned To | => Christian Grothoff |
| 2015-01-26 20:25 | Christian Grothoff | Target Version | => 0.11.0pre66 |
| 2015-01-26 20:25 | Christian Grothoff | Category | core service => util library |
| 2018-06-07 00:25 | Christian Grothoff | Status | resolved => closed |