Updated: October 28, 2024 |
In addition to supporting the API commands of loaded multimedia components, mmcli has built-in commands that allow you to define and structure sequences of API commands.
The mmcli utility parses its input line by line to extract commands. The input text can come from test scripts or an interactive session—mmcli processes commands from both sources identically. In this sense, it acts like an interpreter for a scripting language.
The built-in commands (or keywords) control the processing of other commands. For example, there are keywords for branching, looping, and performing common functions such as waiting for an event. For API commands, mmcli forwards them to the associated components for execution.
Keyword | Arguments | Description |
---|---|---|
cilist | List all loaded modules (libraries). The module names are listed three per line, in fixed-width columns. | |
clock | on | off | Enable or disable the logging of the current time when writing command history or event information to files. By default, this setting is enabled. If you change it in one test script, this setting remains in effect for all other test scripts until it's explicitly changed. |
echo | [text] | Print out a line of text. |
else | Start the else part of a conditional block. This command must be specified after an if, ifdef, or ifndef command but before its corresponding fi command. | |
fi | End a conditional block. This command must be specified after an if, ifdef, or ifndef command, and that command must not already have another fi. | |
file | script | Read and execute commands from a test script. The script argument contains the test script filename. |
global | name val | Define a global variable. This variable is visible in all test scripts and in the interactive session. |
help | [cmd] | Explain all currently available commands or the command named in cmd (if this argument is given). The available commands include all keywords and the API commands of any loaded module. |
if | ok | error | Start a conditional block that will be entered depending on the result of the last command. When ok is given as the argument, the commands that follow will be executed only if the last command succeeded. When error is given, the commands that follow will be executed only if the last command failed. Note that you can nest blocks. |
ifdef | var | Start a conditional block that will be entered only if var matches a variable defined by a global or local command, or by a -D command-line option. Note that you can nest blocks. |
ifndef | var | Start a conditional block that will be entered only if var does not match a variable defined by a global or local command, or by a -D command-line option. Note that you can nest blocks. |
list | List all available API functions. The function names and signatures are listed three per line, in fixed-width columns. | |
load | module | Load a module (library) to make its API functions available. The module argument contains the library filename. |
local | name val | Define a local variable. This variable is visible only in the current test script or the current interactive session. |
log | file | Open a file for logging the results of media commands. |
loop | End a repeat block. This command is supported only in scripts. The commands before a loop command but after the last repeat command will be executed n times (where n is specified by the repeat command). | |
nolog | Close the log file. Command results will no longer be logged. | |
quit | Exit from mmcli. In interactive mode, this command exits the program. In test scripts, this command causes mmcli to stop executing the current script and exit altogether, which is useful if a serious error occurs and you want to shut down the program. Note that other scripts named later on the command line won't be executed because mmcli will exit immediately. | |
repeat | n | Repeat a block of commands. This command is supported only in scripts. The commands between a repeat command and the next loop command will be executed n times. |
setdelay | n | Set a delay of n milliseconds between executing commands in test scripts. |
shell | [cmd] | Launch a shell and execute a command in it (if the cmd argument is given). In test scripts, you can examine the return code of the shell command to see if the OS successfully executed the command specified in cmd. Launching a shell without passing it a command is impractical in a test script because you can't manually enter commands and view their results. In interactive mode, the standard output and error streams from the shell are redirected to mmcli, allowing you to view the command results. If you don't provide the cmd argument, mmcli starts a shell process in the foreground so that you can enter and execute commands in that shell until you close it (by typing exit). |
sleep | n | Delay for n milliseconds. |
trap | on | off | Set or unset the trap condition. If this condition is set, mmcli stops processing the current test script if a command fails. By default, this setting is enabled. If you disable it in one test script, the trap condition is re-enabled when mmcli begins processing the next test script. |
verbosity | module level | Set the logging level for a module (library). The module argument contains the library filename. The level argument is either 0 (for off) or 1 (for on). By default, logging is off. |