Commit Graph
11 Commits
Author SHA1 Message Date
Guido Cella b8df71a411 commands.lua: use the new choices field in command-list
Use the choices field added by ae2384bce0 for command arguments instead
of hardcoding them.
2026-04-06 18:24:30 +02:00
CogentRedTester 149e6dc55b commands.lua: return empty completions on early returns
The new async completion handling code expects an empty list of
completions to be returned if no completions should be shown.
2026-02-27 05:29:06 +01:00
CogentRedTester c568e1539f commands.lua: use new mp.input complete method
Updates to use the new response function passed to
`complete` events to send completions back to `console.lua`. This is to
pre-empt the old return value method being deprecated.
2026-02-24 20:19:24 +01:00
Dudemanguy 11c020f526 player/command: refactor loadfile and loadlist commands to use flags
We should have done this ages ago. These commands essentially consist of
a combination of a load action and whether or not playback should be
started. The old `-play` aliases are kept for backwards compatibility.
2026-01-10 01:00:58 +00:00
nanahi 67378b9c52 commands.lua: update screenshot commands flags 2025-10-06 04:27:13 +02:00
Guido Cella e88864aef3 commands.lua: add remember_input script-opt
Allow clearing the input line on close. Fixes #16104.
2025-03-26 14:56:48 +01:00
Guido Cella b31c3d80ab commands.lua: prevent infinite logging with debug log level
With -v -v there was an infinite loop of log messages, because every new
logged script message to console triggers a new script message, which
gets logged again.
2025-03-23 22:56:39 +01:00
verygoodlee ae3420fe66 DOCS/man/input: correct the mode flag of apply-profile command
The default mode actually named `apply` instead of `default`,
it's a mistake that has existed for a long time.
2025-03-12 10:50:32 +01:00
Kacper Michajłow f751f218bc commands.lua: add cache for often queried constant properties
commands, properties, options, options info, never changes during
runtime, so we can cache them to make the value instantly available.
2025-03-09 11:45:30 +01:00
Guido Cella 061b83d479 commands.lua: complete filesystem paths for run
Complete file paths after e.g. run mv ${path}. This is similar to how
shells complete file paths for all commands without known completions.
2025-03-08 19:09:23 +00:00
Guido Cella 0b3cc3a167 commands.lua: split this script out of console.lua
It was suggested by CogentRedTester in
https://github.com/mpv-player/mpv/pull/10282#issuecomment-1858727729 and
https://github.com/mpv-player/mpv/pull/10282#issuecomment-1858809580 and
by avih that making running commands an mp.input client is a better
architecture.

A practical advantage is that completions are calculated in a different
thread, which prevents hanging when completing slow/network filesystems.

script-binding console/enable becomes script-binding commands/open,
though the console one is kept as an alias. I took the opportunity to
rename this because open makes more sense for a graphical modal, and it
is the word used in mp.input and user-data.

script-message-to console type becomes script-message-to commands type,
though the console one is kept as an alias. It is also changed to
automatically close on submit without having to append '; keypress ESC'
as you don't need to keep the console open after running prefilled
commands.

Also convert to double quotes like other scripts and rename some
inconsistent functions.
2025-03-08 19:09:23 +00:00