Oh, so many troubles just because of the scripts. That's the reason why Twister was created. Twister is a simple framework/tool that allows to create and manage project scripts. I use it in a few of my home projects, and find it very helpful. About a year ago, I open sourced Twister. It's a python project, so it makes it simple to create scripts and execute them on any popular operating system.
Twister helps to achieve next goals:
- Structure project scripts into groups (known as modules).
- Separate scripts from different projects by having different twister setups and aliases
- Simple and single structure to create scripts. As result, also a single place for all project scripts.
- Set of built-it commands to enumerate commands, find interested command and see its description
build
from module dev
. This can be done as simple as:twister dev buildIn case the command is used often, it's possible to create an alias for it. For example, for
dev build
there could be added alias bld
, so previous command shorts to:twister bldBuilt-in commands does not require any module name.
Twister should be setup separately for each project. I usually put twister directory into the same Git repository. I add modules and scripts to the project's twister setup then. Thus, I keep twister and my scripts in the version control. Which is very convenient. After than, I use the
add-shortcut
command to create a shortcut in PATH to the project's twister. As I have multiple twister setups, I use project name instead of twister
. For example, let I have a project name colibri. There is a separate twister setup for it, with custom build script. My first move is to setup a shortcut to colibri's twister:./twister.py add-shortcut --name colibriThis will create a soft-link to the local twister setup, will name this link colibri and will place it into
/usr/local/bin
directory. So this makes it possible to execute the command anywhere in the path, it will be still executed in relative position to the twister setup:colibri dev build
Each twister command comes with next parts:
- list of arguments
- short description
- long description
- executable logic itself
twister
directory. Each module contains file _commands.py
which declares what commands are exported by module.Twister goes with list of built-in commands, that allows quickly review available modules, commands, find commands and see their documentation. Such commands are:
find-command
- find a command in any module that matches the search criterialist-commands
- list all commands in all moduleslist-modules
- list all moduleslist-aliases
- list all defined aliases
No comments:
Post a Comment