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

Pavel Březina pbrezina at redhat.com
Tue Aug 25 11:36:24 UTC 2015


On 08/25/2015 01:32 PM, Petr Cech wrote:
> On 08/25/2015 01:00 PM, Pavel Březina wrote:
>> https://fedorahosted.org/sssd/ticket/2758
>>
> Hi Pavel,
> I have 3 formal comments to coding style.
> Now I am running the tests. I will send you mail
> with results soon.
> Petr
>> 0001-sss_override-document-debug-options.patch
>>
>>
>>  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>
>> -
>> +
>      ^^^^
> There are 4 trailing white spaces.

Fixed.

>>       <refsect1 id='commands'>
>>           <title>AVAILABLE COMMANDS</title>
>>           <para>
>> @@ -189,6 +189,22 @@
>>               </varlistentry>
>>           </variablelist>
>>       </refsect1>
>> +
> ^^^^
> There are 4 trailing white spaces too.

Fixed.

>> +    <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"));
> I'm not sure, but is it habbit to indent to '('?
> I mean:
>
> || +    fprintf(stderr, "  -d, --debug=INT        %s\n",
> || +            _("Enable debug at level"));

I tend to indent to format specifier if possible, so format and data 
remains together.

>
>> +}
>> +
>>   static void sss_tool_common_opts(struct sss_tool_ctx *tool_ctx,
>>                                    int *argc, const char **argv)
>>   {
>> @@ -201,6 +208,9 @@ int sss_tool_usage(const char *tool_name,
>>           fprintf(stderr, "* %s\n", commands[i].command);
>>       }
>>
>> +    fprintf(stderr, _("\n"));
>> +    sss_tool_print_common_opts();
>> +
>>       return EXIT_FAILURE;
>>   }
>>
>> @@ -237,6 +247,13 @@ int sss_tool_route(int argc, const char **argv,
>>       return sss_tool_usage(argv[0], commands);
>>   }
>>
>> +static void sss_tool_popt_print_help(poptContext pc)
>> +{
>> +    poptPrintHelp(pc, stderr, 0);
>> +    fprintf(stderr, "\n");
>> +    sss_tool_print_common_opts();
>> +}
>> +
>>   int sss_tool_popt_ex(struct sss_cmdline *cmdline,
>>                        struct poptOption *options,
>>                        enum sss_tool_opt require_option,
>> @@ -286,7 +303,7 @@ int sss_tool_popt_ex(struct sss_cmdline *cmdline,
>>           } else {
>>               fprintf(stderr, _("Invalid option %s: %s\n\n"),
>>                       poptBadOption(pc, 0), poptStrerror(ret));
>> -            poptPrintHelp(pc, stderr, 0);
>> +            sss_tool_popt_print_help(pc);
>>               ret = EXIT_FAILURE;
>>               goto done;
>>           }
>> @@ -297,7 +314,7 @@ int sss_tool_popt_ex(struct sss_cmdline *cmdline,
>>           *_fopt = poptGetArg(pc);
>>           if (*_fopt == NULL) {
>>               fprintf(stderr, _("Missing option: %s\n\n"), fopt_help);
>> -            poptPrintHelp(pc, stderr, 0);
>> +            sss_tool_popt_print_help(pc);
>>               ret = EXIT_FAILURE;
>>               goto done;
>>           }
>> @@ -305,7 +322,7 @@ int sss_tool_popt_ex(struct sss_cmdline *cmdline,
>>           /* No more arguments expected. If something follows it is an error. */
>>           if (poptGetArg(pc)) {
>>               fprintf(stderr, _("Only one free argument is expected!\n\n"));
>> -            poptPrintHelp(pc, stderr, 0);
>> +            sss_tool_popt_print_help(pc);
>>               ret = EXIT_FAILURE;
>>               goto done;
>>           }
>> @@ -315,7 +332,7 @@ int sss_tool_popt_ex(struct sss_cmdline *cmdline,
>>       if (require_option == SSS_TOOL_OPT_REQUIRED
>>               && ((_fopt != NULL && cmdline->argc < 2) || cmdline->argc < 1)) {
>>           fprintf(stderr, _("At least one option is required!\n\n"));
>> -        poptPrintHelp(pc, stderr, 0);
>> +        sss_tool_popt_print_help(pc);
>>           ret = EXIT_FAILURE;
>>           goto done;
>>       }
>> -- 2.1.0
>>
>
>
>
> _______________________________________________
> sssd-devel mailing list
> sssd-devel at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/sssd-devel
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-sss_override-document-debug-options.patch
Type: text/x-patch
Size: 4279 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20150825/566accc9/attachment.bin>


More information about the sssd-devel mailing list