0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-19 19:42:24 +02:00

player: add option-info/<name>/expects-file

This will allow console.lua to complete files after e.g. set
glsl-shaders <Tab>.
This commit is contained in:
Guido Cella 2024-05-07 15:01:38 +02:00 committed by Kacper Michajłow
parent 4e5845ad03
commit c4b03700e1
4 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1 @@
add "option-info/<name>/expects-file" sub-property

View File

@ -3678,6 +3678,9 @@ Property list
means the option value will be restored to the value before playback
start when playback ends.
``option-info/<name>/expects-file``
Whether the option takes file paths as arguments.
``option-info/<name>/default-value``
The default value of the option. May not always be available.

View File

@ -3650,6 +3650,7 @@ static int mp_property_option_info(void *ctx, struct m_property *prop,
{"type", SUB_PROP_STR(opt->type->name)},
{"set-from-commandline", SUB_PROP_BOOL(co->is_set_from_cmdline)},
{"set-locally", SUB_PROP_BOOL(co->is_set_locally)},
{"expects-file", SUB_PROP_BOOL(opt->flags & M_OPT_FILE)},
{"default-value", *opt, def},
{"min", SUB_PROP_DOUBLE(opt->min),
.unavailable = !(has_minmax && opt->min != DBL_MIN)},

View File

@ -934,7 +934,7 @@ local function property_list()
for _, sub_property in pairs({
'name', 'type', 'set-from-commandline', 'set-locally',
'default-value', 'min', 'max', 'choices',
'expects-file', 'default-value', 'min', 'max', 'choices',
}) do
properties[#properties + 1] = 'option-info/' .. option .. '/' ..
sub_property