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.
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.
Examples
Without preferred tools
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)
up_command:
preferred_tools:
- nix
- homebrew
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