Extending the tt functionality
tt utility implements a modular architecture: its commands
are, in fact, separate modules. When you run
tt with a command, the
corresponding module is executed with the given arguments.
The modular architecture enables the option to extend the
tt functionality with
external modules (as opposed to internal modules that implement built-in
commands). Simply said, you can write any code you want to execute
tt, pack it into an executable, and run it with a
tt my-module-name my-args
The name of the command that executes a module is the same as the name of the module’s executable.
Executables that implement external
tt modules must have two flags:
--description– print a short description of the module. The description is shown alongside the command in the
--help– display help. The help message is shown when
tt help <module_name>is called.
External modules must be located in the modules directory specified in the configuration file:
tt: modules: directory: path/to/modules/dir
To check if a module is available in
It will show the available external modules in the
EXTERNAL COMMANDS section together
with their descriptions.
External modules can overload built-in
If you want to change the behavior of a built-in command, create an external
module with the same name and your own implementation.
tt sees two modules – an external and an internal one – with the same
name, it will use the external module by default.
For example, if you want
tt to show the information about your Tarantool
application, write the external module
version that outputs the information
you need. The
tt version call will execute this module instead of the built-in one:
tt version # Calls the external module if it's available
You can force the use of the internal module by running
tt with the
option. The following call will execute the built-in
even if there is an external module with the same name:
tt version -I # Calls the internal module