[glib] Added describe command to gsettings command-line tool.
- From: Jeremy Whiting <jpwhiting src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Added describe command to gsettings command-line tool.
- Date: Thu, 25 Aug 2016 18:42:56 +0000 (UTC)
commit 8fd72838ced613b74b6c1bf5dcc92200fcf3db05
Author: Jeremy Whiting <jpwhiting kde org>
Date: Thu Aug 25 12:39:33 2016 -0600
Added describe command to gsettings command-line tool.
describe command shows description of given gsettings key.
Added documentation of describe command to gsettings man page.
docs/reference/gio/gsettings.xml | 13 +++++++++++++
gio/gsettings-tool.c | 21 +++++++++++++++++++++
2 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gio/gsettings.xml b/docs/reference/gio/gsettings.xml
index 3f3ef97..9528b9d 100644
--- a/docs/reference/gio/gsettings.xml
+++ b/docs/reference/gio/gsettings.xml
@@ -50,6 +50,12 @@
</cmdsynopsis>
<cmdsynopsis>
<command>gsettings</command>
+ <arg choice="plain">describe</arg>
+ <arg choice="plain"><replaceable>SCHEMA</replaceable><arg
choice="opt">:<replaceable>PATH</replaceable></arg></arg>
+ <arg choice="plain"><replaceable>KEY</replaceable></arg>
+ </cmdsynopsis>
+ <cmdsynopsis>
+ <command>gsettings</command>
<arg choice="plain">set</arg>
<arg choice="plain"><replaceable>SCHEMA</replaceable><arg
choice="opt">:<replaceable>PATH</replaceable></arg></arg>
<arg choice="plain"><replaceable>KEY</replaceable></arg>
@@ -158,6 +164,13 @@ Queries the range of valid values for <replaceable>KEY</replaceable>.
</varlistentry>
<varlistentry>
+<term><option>describe</option></term>
+<listitem><para>
+Queries the description of valid values for <replaceable>KEY</replaceable>.
+</para></listitem>
+</varlistentry>
+
+<varlistentry>
<term><option>set</option></term>
<listitem><para>
Sets the value of <replaceable>KEY</replaceable> to
diff --git a/gio/gsettings-tool.c b/gio/gsettings-tool.c
index 0026f55..88f304b 100644
--- a/gio/gsettings-tool.c
+++ b/gio/gsettings-tool.c
@@ -271,6 +271,14 @@ gsettings_list_recursively (void)
}
static void
+gsettings_description (void)
+{
+ const gchar *description;
+ description = g_settings_schema_key_get_description (global_schema_key);
+ g_print ("%s\n", description);
+}
+
+static void
gsettings_range (void)
{
GVariant *range, *detail;
@@ -562,6 +570,12 @@ gsettings_help (gboolean requested,
synopsis = N_("SCHEMA[:PATH] KEY");
}
+ else if (strcmp (command, "describe") == 0)
+ {
+ description = _("Query the description for KEY");
+ synopsis = N_("SCHEMA[:PATH] KEY");
+ }
+
else if (strcmp (command, "set") == 0)
{
description = _("Set the value of KEY to VALUE");
@@ -615,6 +629,7 @@ gsettings_help (gboolean requested,
" list-children List children of a schema\n"
" list-recursively List keys and values, recursively\n"
" range Queries the range of a key\n"
+ " describe Queries the description of a key\n"
" get Get the value of a key\n"
" set Set the value of a key\n"
" reset Reset the value of a key\n"
@@ -752,6 +767,12 @@ main (int argc, char **argv)
else if ((argc == 2 || argc == 3) && strcmp (argv[1], "list-recursively") == 0)
function = gsettings_list_recursively;
+ else if (argc == 4 && strcmp (argv[1], "describe") == 0)
+ {
+ need_settings = FALSE;
+ function = gsettings_description;
+ }
+
else if (argc == 4 && strcmp (argv[1], "range") == 0)
{
need_settings = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]