[vlc-commits] [Git][videolan/vlc][master] help: fix confusing -p (module help) for mods with no options

Hugo Beauzée-Luyssen gitlab at videolan.org
Fri May 7 19:21:34 UTC 2021



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
90fb5683 by Lyndon Brown at 2021-05-07T18:15:27+00:00
help: fix confusing -p (module help) for mods with no options

it confused me in the past when I tried `vlc -p pulse` and it came back
with an error stating that no matching module was found, and to look in
the list generated by --list, when that does in fact contain a module with
that name.

the problem is that the module has no options (nor pulsesrc/pulselist),
and the underlying logic is geared primarily towards --full-help/--longhelp
output which deliberately skips over such modules.

i have finally looked into this and fixed the confusing behaviour by
avoiding skipping over modules when in search mode, so now we output
minimal details about such modules along with a statement that it has no
options when looking up modules, but continue to skip over them in
--full-help/--longhelp output.

old output:
```
lyndon at desktop ~$ vlc -p pulse
VLC media player 4.0.0-dev Otto Chriek (revision 4.0.0-dev-15406-g183c8d9971)

No matching module found. Use --list or --list-verbose to list available modules.
```

new output:
```
lyndon at desktop ~$ vlc -p pulse
VLC media player 4.0.0-dev Otto Chriek (revision 4.0.0-dev-15407-g19c204c671)

 Pulseaudio audio output (pulse)
  This module has no options.

 PulseAudio input (pulsesrc)
 Pass pulse:// to open the default PulseAudio source, or pulse://SOURCE to open a specific source named SOURCE.
  This module has no options.

 Audio capture (PulseAudio) (pulselist)
  This module has no options.
```

- - - - -


1 changed file:

- src/config/help.c


Changes:

=====================================
src/config/help.c
=====================================
@@ -603,13 +603,13 @@ static void Usage (vlc_object_t *p_this, char const *psz_search)
         const module_config_t *section = NULL;
         const char *objname = module_get_object(m);
 
-        if (p->conf.count == 0)
+        if (psz_search == NULL && p->conf.count == 0)
             continue; /* Ignore modules without config options */
         if (!module_match(m, psz_search, strict))
             continue;
         found = true;
 
-        if (!plugin_show(p))
+        if (psz_search == NULL && !plugin_show(p))
             continue;
 
         /* Print name of module */
@@ -619,6 +619,9 @@ static void Usage (vlc_object_t *p_this, char const *psz_search)
             printf(color ? CYAN" %s\n"GRAY : " %s\n",
                    module_gettext(m, m->psz_help));
 
+        if (psz_search != NULL && p->conf.count == 0)
+            printf("  %s\n", _("This module has no options."));
+
         /* Print module options */
         for (size_t j = 0; j < p->conf.size; j++)
         {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/90fb56834f0ab753c67f362dae8612d33965ed36

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/90fb56834f0ab753c67f362dae8612d33965ed36
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list