The utopya CLI supports completion of parts of its CLI like model names, project names, or run directories. For instance, the following will list all registered models:
utopya run <tab>
To enable shell completion, follow the steps described in the click documentation 📚.
Make sure to select the appropriate shell and replace the
foo-bar placeholder with
We recommend to install shell-completion to a file to not reduce shell responsiveness.
To find out which shell you are using, run any of the following commands:
ps -p "$$"
If you are a Utopia user, repeat the process using
utopia instead of
Why do I have to do this manually?
Basically, we think that changes to your shell configuration should not be automated — this should be a deliberate decision on your side. Click, the framework used to implement the utopya CLI, does not do this automatically, either.
But: The setup is not difficult, it’s well-documented by click, and there is an example here as well.
Say your shell is
zsh, then the commands to install the utopya CLI shell completion (via the file-based approach) are:
_UTOPYA_COMPLETE=zsh_source utopya > ~/.utopya-complete.zsh
After that, source the file in your
~/.zshrc by adding the following line:
You will need to restart your shell for the changes to take effect.
utopya eval MODEL_NAME [RUN_DIR] …, the run directory can be auto-completed.
However, the following remarks need to be taken into account.
As run directories (where the output of a simulation is written to) can be configured individually for each and every run, there is no single place in which to search for completion suggestions of run directories.
Thus, the completion only looks at a (configurable) list of search directories, which include the canonical
You can still specify absolute or relative paths for the
RUN_DIR argument, but they will not be auto-completed.
Run directories not shown correctly?
If suggestions for run directories are not correct, they may be missing from the search paths. See below on how to configure which paths are being searched to generate the suggestions.
To configure this list, run:
utopya config utopya --edit
and adjust the
# Canonical locations:
# Custom locations
# ... can add more here ...
If you don’t want to use the CLI for editing the entry, manually open the
~/.config/utopya/utopya_cfg.yml or create it, if it does not exist.