Skip to main content

any operation

Composite operation that takes a list of operations as parameter.

When called during omni up, it will reorder the list to consider the configured preferred tools first, then the rest in the order they were defined. It will then execute operations in the list until one of them is available and succeeds. If none of the operations are available, the any operation will be considered unavailable. If none of the available operations succeed, the any operation will fail.

When called during omni down, it will execute all operations in the list.

note

The any operation is useful when you want to install a package using different package managers, and you want to use the first available one. It is also useful when you want to use a preferred tool over others.

info

Other operations requiring to install dependencies (e.g. python, ruby, node, go, etc.) are using an any operation internally to install the required dependencies prior to installing the requested tool.

Examples

Without preferred tools

~/git/<repo path>/.omni.yaml
up:
# Installs gawk using either homebrew or nix, whichever is available,
# and if both are available will use homebrew in priority if no preferred
# tools are configured.
- any:
- homebrew:
install:
- gawk
- nix:
- gawk

With preferred tools (nix, then brew)

~/.config/omni/config.yaml
up_command:
preferred_tools:
- nix
- homebrew
~/git/<repo path>/.omni.yaml
up:
# Installs gawk using either homebrew or nix, whichever is available,
# and if both are available will use nix in priority since it is a
# preferred tool that has a higher priority than homebrew.
- any:
- homebrew:
install:
- gawk
- nix:
- gawk