Skip to main content

Configuration commands

You can check the commands configuration parameter to read how to define configuration commands.

Current working directory

Configuration commands are run from the directory in which the configuration file defining them is located to make sure that any relative path used in the command will always be valid.

Scope

Configuration commands are scoped to a repository when defined in the omni configuration of that repository, or can be made available everywhere if defined in a global configuration file. If you want to access a repository-scoped configuration command, you can use omni scope.

Environment

The following environment variables are set by omni before the Configuration command is called:

Environment variableTypeDescription
OMNI_SUBCOMMANDstring...The subcommand that was called leading to the execution of that command; e.g. my command for omni my command
OMNI_CWDpathThe current working directory where omni was called from

The following environment variables are set by the shell integration and can be taken advantage of when writing commands:

Environment variableTypeDescription
OMNI_SHELLstringThe shell of the user for which the shell integration was loaded
OMNI_CMD_FILEfilepathThe file in which omni will read operations to apply to the shell; this needs to be compatible with the shell of the user as provided by OMNI_SHELL