From c4b03700e1cceb951158044c63cee127c39cd6b0 Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Tue, 7 May 2024 15:01:38 +0200 Subject: [PATCH] player: add option-info//expects-file This will allow console.lua to complete files after e.g. set glsl-shaders . --- DOCS/interface-changes/option-info-expects-file.txt | 1 + DOCS/man/input.rst | 3 +++ player/command.c | 1 + player/lua/console.lua | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 DOCS/interface-changes/option-info-expects-file.txt diff --git a/DOCS/interface-changes/option-info-expects-file.txt b/DOCS/interface-changes/option-info-expects-file.txt new file mode 100644 index 0000000000..c8a54da0a7 --- /dev/null +++ b/DOCS/interface-changes/option-info-expects-file.txt @@ -0,0 +1 @@ +add "option-info//expects-file" sub-property diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index e0bfadf98f..8d839cb6da 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -3678,6 +3678,9 @@ Property list means the option value will be restored to the value before playback start when playback ends. + ``option-info//expects-file`` + Whether the option takes file paths as arguments. + ``option-info//default-value`` The default value of the option. May not always be available. diff --git a/player/command.c b/player/command.c index 65469988d9..6cfd25b6fa 100644 --- a/player/command.c +++ b/player/command.c @@ -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)}, diff --git a/player/lua/console.lua b/player/lua/console.lua index 6b649184fd..be966008bb 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -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