options: change --h=... behavior

Does not match a shell pattern anymore. Instead, a simple sub-string
search is done.
This commit is contained in:
wm4
2016-12-16 16:09:10 +01:00
parent a8347eb9ba
commit aab98776f6
4 changed files with 6 additions and 15 deletions

View File

@@ -350,9 +350,10 @@ Program Behavior
``--help``, ``--h`` ``--help``, ``--h``
Show short summary of options. Show short summary of options.
You can also pass a shell pattern to this option, which will list all You can also pass a string to this option, which will list all top-level
matching top-level options, e.g. ``--h=*scale*`` for all options that options which contain the string in the name, e.g. ``--h=scale`` for all
contain the word "scale". options that contain the word ``scale``. The special string ``*`` lists
all top-level options.
``-v`` ``-v``
Increment verbosity level, one level for each ``-v`` found on the command Increment verbosity level, one level for each ``-v`` found on the command

View File

@@ -29,10 +29,6 @@
#include <stdbool.h> #include <stdbool.h>
#include <pthread.h> #include <pthread.h>
#if HAVE_FNMATCH
#include <fnmatch.h>
#endif
#include "libmpv/client.h" #include "libmpv/client.h"
#include "mpv_talloc.h" #include "mpv_talloc.h"
@@ -956,10 +952,8 @@ void m_config_print_option_list(const struct m_config *config, const char *name)
const struct m_option *opt = co->opt; const struct m_option *opt = co->opt;
if (co->is_hidden) if (co->is_hidden)
continue; continue;
#if HAVE_FNMATCH if (strcmp(name, "*") != 0 && !strstr(co->name, name))
if (fnmatch(name, co->name, 0))
continue; continue;
#endif
MP_INFO(config, " %s%-30s", prefix, co->name); MP_INFO(config, " %s%-30s", prefix, co->name);
if (opt->type == &m_option_type_choice) { if (opt->type == &m_option_type_choice) {
MP_INFO(config, " Choices:"); MP_INFO(config, " Choices:");

View File

@@ -96,7 +96,7 @@ const char mp_help_text[] =
" --playlist=<file> specify playlist file\n" " --playlist=<file> specify playlist file\n"
"\n" "\n"
" --list-options list all mpv options\n" " --list-options list all mpv options\n"
" --h=<pat> print options which match the given shell pattern\n" " --h=<string> print options which contain the given string in their name\n"
"\n"; "\n";
static pthread_mutex_t terminal_owner_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t terminal_owner_lock = PTHREAD_MUTEX_INITIALIZER;

View File

@@ -127,10 +127,6 @@ main_dependencies = [
# This should be good enough. # This should be good enough.
'func': check_statement(['poll.h', 'unistd.h', 'sys/mman.h'], 'func': check_statement(['poll.h', 'unistd.h', 'sys/mman.h'],
'struct pollfd pfd; poll(&pfd, 1, 0); fork(); int f[2]; pipe(f); munmap(f,0)'), 'struct pollfd pfd; poll(&pfd, 1, 0); fork(); int f[2]; pipe(f); munmap(f,0)'),
}, {
'name': 'fnmatch',
'desc': 'fnmatch()',
'func': check_statement('fnmatch.h', 'fnmatch("", "", 0)')
}, { }, {
'name': 'posix-or-mingw', 'name': 'posix-or-mingw',
'desc': 'development environment', 'desc': 'development environment',