1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-11 08:37:59 +00: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 means the option value will be restored to the value before playback
start when playback ends. start when playback ends.
``option-info/<name>/expects-file``
Whether the option takes file paths as arguments.
``option-info/<name>/default-value`` ``option-info/<name>/default-value``
The default value of the option. May not always be available. 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)}, {"type", SUB_PROP_STR(opt->type->name)},
{"set-from-commandline", SUB_PROP_BOOL(co->is_set_from_cmdline)}, {"set-from-commandline", SUB_PROP_BOOL(co->is_set_from_cmdline)},
{"set-locally", SUB_PROP_BOOL(co->is_set_locally)}, {"set-locally", SUB_PROP_BOOL(co->is_set_locally)},
{"expects-file", SUB_PROP_BOOL(opt->flags & M_OPT_FILE)},
{"default-value", *opt, def}, {"default-value", *opt, def},
{"min", SUB_PROP_DOUBLE(opt->min), {"min", SUB_PROP_DOUBLE(opt->min),
.unavailable = !(has_minmax && opt->min != DBL_MIN)}, .unavailable = !(has_minmax && opt->min != DBL_MIN)},

View File

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