Re: [PATCH 06/41] remote: stop trying to print help as giant blocks of text

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2019-07-23 at 17:02 +0100, Daniel P. Berrangé wrote:
[...]
> +    struct virOptionHelp {
> +        const char *opts;
> +        const char *help;
> +    } opthelp[] = {
> +        { "-h | --help", N_("Display program help") },
> +        { "-v | --verbose", N_("Verbose messages") },
> +        { "-d | --daemon", N_("Run as a daemon & write PID file") },
> +        { "-l | --listen", N_("Listen for TCP/IP connections") },
> +        { "-t | --timeout <secs>", N_("Exit after timeout period") },
> +        { "-f | --config <file>", N_("Configuration file") },
> +        { "-V | --version", N_("Display version information") },
> +        { "-p | --pid-file <file>", N_("Change name of PID file") },
> +    };

The way you declare the struct at the same time as you use it for a
local variable is highly unusual in our codebase, especially
considering that you do the former inside a function which is, at
least as far as I'm aware, basically unprecedented in libvirt.

Can you please move the struct declaration outside of the function?

[...]
> +    fprintf(stderr, "    %s:\n", _("TLS"));
> +    fprintf(stderr, "      %s: %s\n",
> +            _("CA certificate"),
> +            privileged ? LIBVIRT_CACERT : "$HOME/.pki/libvirt/cacert.pem");
> +    fprintf(stderr, "      %s: %s\n",
> +            _("Server certificate"),
> +            privileged ? LIBVIRT_SERVERCERT : "$HOME/.pki/libvirt/servercert.pem");
> +    fprintf(stderr, "      %s: %s\n",
> +            _("Server private key"),
> +            privileged ? LIBVIRT_SERVERKEY : "$HOME/.pki/libvirt/serverkey.pem");
> +    fprintf(stderr, "\n");

I think the above would work better if you used

  "      %-18s  %s\n"

as the format string, which would result in

  TLS:
    CA certificate      $HOME/.pki/libvirt/cacert.pem
    Server certificate  $HOME/.pki/libvirt/servercert.pem
    Server private key  $HOME/.pki/libvirt/serverkey.pem

instead of

  TLS:
    CA certificate: $HOME/.pki/libvirt/cacert.pem
    Server certificate: $HOME/.pki/libvirt/servercert.pem
    Server private key: $HOME/.pki/libvirt/serverkey.pem

as the output. Not a big deal either way, but since we're going out
of our way to align options and their descriptions above it makes
sense to me that we'd do the same here as well.


After this patch, the code looks much less readable, but I understand
why you want to do this and you also get rid of some duplication when
it comes to the system/session daemons, so I'm overall okay with the
change.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux