[SSSD] [PATCH] sss_override: document --debug options

Lukas Slebodnik lslebodn at redhat.com
Thu Aug 27 10:49:48 UTC 2015


On (25/08/15 13:00), Pavel Březina wrote:
>https://fedorahosted.org/sssd/ticket/2758

>From f181b0a94863f082abaf074a0940e83fbf1c89b1 Mon Sep 17 00:00:00 2001
>From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina at redhat.com>
>Date: Tue, 25 Aug 2015 12:58:45 +0200
>Subject: [PATCH] sss_override: document --debug options
>
>Resolves:
>https://fedorahosted.org/sssd/ticket/2758
>---
> src/man/sss_override.8.xml   | 18 +++++++++++++++++-
> src/tools/common/sss_tools.c | 25 +++++++++++++++++++++----
> 2 files changed, 38 insertions(+), 5 deletions(-)
>
>diff --git a/src/man/sss_override.8.xml b/src/man/sss_override.8.xml
>index d289f5b7dfa7fbd328831b4c71d45b4c555225cf..3db8cbe05322ddf662faaa4810cd3bf6b25f8883 100644
>--- a/src/man/sss_override.8.xml
>+++ b/src/man/sss_override.8.xml
>@@ -38,7 +38,7 @@
>             all local overrides are lost.
>         </para>
>     </refsect1>
>-
>+    
>     <refsect1 id='commands'>
>         <title>AVAILABLE COMMANDS</title>
>         <para>
>@@ -189,6 +189,22 @@
>             </varlistentry>
>         </variablelist>
>     </refsect1>
>+    
>+    <refsect1 id='options'>
>+        <title>COMMON OPTIONS</title>
>+        <para>
>+            Those options are available with all commands.
>+        </para>
>+        <variablelist remap='IP'>
>+            <varlistentry>
>+                <term>
>+                    <option>-d</option>,<option>--debug</option>
>+                    <replaceable>LEVEL</replaceable>
>+                </term>
>+                <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="include/debug_levels.xml" />
>+            </varlistentry>
>+        </variablelist>
>+    </refsect1>
> 
>     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="include/seealso.xml" />
> 
>diff --git a/src/tools/common/sss_tools.c b/src/tools/common/sss_tools.c
>index 6bbce3a25ddddc0b23ebc108a917a38e94981b65..3e732a3411494262ea34a1e5c332e86f5128e771 100644
>--- a/src/tools/common/sss_tools.c
>+++ b/src/tools/common/sss_tools.c
>@@ -36,6 +36,13 @@ struct sss_cmdline {
>     const char **argv;
> };
> 
>+static void sss_tool_print_common_opts(void)
>+{
>+    fprintf(stderr, _("Common options:\n"));
>+    fprintf(stderr, "  -d, --debug=INT        %s\n",
>+                    _("Enable debug at level"));
NACK
This does not correspond with reality. The sort version does not work.

It would be good to test own patches :-)

[root at host ~]# sss_override -d=9 user-add
Usage:
    sss_override COMMAND COMMAND-ARGS

    Available commands:
    * user-add
    * user-del
    * group-add
    * group-del

[root at host ~]# sss_override --debug=2 user-add
Missing option: Specify name of modified object.

Usage: sss_override user-add NAME [OPTIONS...]
  -n, --name=STRING      Override name
  -u, --uid=INT          Override uid (non-zero value)
  -g, --gid=INT          Override gid (non-zero value)
  -h, --home=STRING      Override home directory
  -s, --shell=STRING     Override shell
  -c, --gecos=STRING     Override gecos

Help options:
  -?, --help             Show this help message
      --usage            Display brief usage message
(Thu Aug 27 12:32:49:273331 2015) [sssd] [parse_cmdline] (0x0020): Unable to parse command arguments
(Thu Aug 27 12:32:49:273461 2015) [sssd] [override_user_add] (0x0020): Unable to parse command line.

As you can see long version works.


I would be also curious why you need to provide hacks
for printing argument description for autohelp.
There is a much more elegant way how to do it with libpopt.
(small hint POPT_ARGFLAG_DOC_HIDDEN in sss_tool_common_opts)

LS


More information about the sssd-devel mailing list