CLI
Motion’s WP-CLI commands live under wp sleek motion and cover what makes
sense from a terminal: the settings, presets and breakpoints. Animations live
in your content as classes, so there is nothing else to script. Every
argument and option is in the WP-CLI reference.
Settings
wp sleek motion settings get prints the settings, or one value by dot path,
and wp sleek motion settings update changes one value:
wp sleek motion settings get --format=json
wp sleek motion settings get editor.enable
wp sleek motion settings update editor.enable true
wp sleek motion settings update className animate
update gives the value the type Motion’s settings declare for the path, as
the WP-CLI reference says:
- A text setting, such as
className, keeps the value as you type it, so123is stored as the text123. - An on/off setting, such as
editor.enableorreducedMotion, takestrue,false,1,0,yes,no,onoroff. - A path the settings do not declare stores
trueandfalseas booleans, numbers as numbers and anything else as text.
Unlike the settings screen, update does not check the value: an on/off
setting given anything else is stored as an undeclared path would be, so
maybe is stored as the text maybe. When WordPress refuses to save the
settings, the command fails and nothing changes.
Presets and breakpoints
The two lists have the same three commands:
wp sleek motion preset list --format=json
wp sleek motion preset add fade-up "from:opacity-0|y-20"
wp sleek motion preset remove fade-up
wp sleek motion breakpoint list
wp sleek motion breakpoint add lg "(min-width: 1024px)"
wp sleek motion breakpoint remove lg
add replaces an entry with the same name, and remove fails when there is
none.
In the assistant
Motion’s assistant can run these eight commands for you in the workspace,
with the same arguments; its list commands always answer in JSON.