Skip to content

ContextHandling

Alexis Lucattini edited this page Dec 23, 2022 · 6 revisions

Local contexts

The icav2 cli binary uses the ~/.icav2/.session.ica.yaml file to handle project contexts by setting the 'project-id' key.

This can cause conflicts for users working in multiple contexts in separate terminal sessions.

With the icav2 cli plugin we can work around this by masking icav2 projects enter as a function instead.

Help page

Usage: icav2 projects enter [projectname] [--global] [--help]
This command sets the project context for future commands by updating
the ICAV2_PROJECT_ID env var.  If you wish to set the project id globally, please
use the --global parameter

Example:
  icav2 projects enter playground_v2

Parameters:
  -g, --global set project id globally
  -h, --help   help for enter

Enter a context locally

Use the following code to enter a context in your current terminal

icav2 projects enter <project_name>

Enter a context globally

You can still enter contexts globally, as one would with the original icav2 projects enter command.

Use the -g option to enter the context in all terminals.

Note this will NOT affect existing terminals with the env var ICAV2_PROJECT_ID set.

icav2 projects enter -g <project_name>

Autocompletion

You can press <tab> to produce a list of available project contexts

GIF Example

enter_project