You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dbdaa8c
Browse filesBrowse the repository at this point in the historyBrowse files
Document that default is the only active context, how to recreate
aliases from inactive contexts, the new context status output, and the
deprecation of prefer.
Copy file name to clipboardExpand all lines: docs/how-to-guides/manage-instances/use-instance-command-aliases.md
+22-10Lines changed: 22 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,9 +29,21 @@ multipass alias crazy-cat:pwd pwdcc --no-map-working-directory
29
29
30
30
> See also: [`prefer`](reference-command-line-interface-prefer)
31
31
32
-
Contexts are sets of aliases. While one can safely work with one context, named `default`, contexts can be useful in some scenarios; for example, to define aliases with the same name in different instances.
32
+
```{caution}
33
+
Context switching and the `prefer` command are deprecated. Only the `default` context remains active. Existing non-default contexts are inactive, even if one was selected before upgrading.
34
+
```
35
+
36
+
Contexts are sets of aliases. Multipass keeps existing non-default contexts and their definitions so that you can inspect and recreate aliases, but those aliases cannot run. This applies to both `multipass <alias>` and alias scripts on your `PATH`, including context-qualified names.
37
+
38
+
To migrate an inactive alias, use `multipass aliases` to find its instance, command, and working-directory setting. For example, recreate an alias `secondary.lscc` that runs `ls` on `cozy-canary` with a unique name:
39
+
40
+
```{code-block} text
41
+
multipass alias cozy-canary:ls ls-secondary
42
+
```
43
+
44
+
The new alias belongs to `default` and can be run with `multipass ls-secondary`. If the original working-directory setting is `default`, include `--no-map-working-directory` when recreating it.
33
45
34
-
You can switch to using another context with `multipass prefer secondary`. Then, defining an alias in the new context is done in the usual way. The name of the alias can coincide with an already defined one. For example, `multipass alias cozy-canary:ls lscc`.
46
+
The inactive definition remains available until you remove it, for example with `multipass unalias secondary.lscc`. `multipass prefer` reports an error and cannot reactivate contexts.
35
47
36
48
## List the existing aliases
37
49
@@ -42,13 +54,13 @@ To see the list of aliases defined so far, use the `multipass aliases` command.
42
54
The output will be similar to the following:
43
55
44
56
```{code-block} text
45
-
Alias Instance Command Context Working directory
46
-
lscc crazy-cat ls default map
47
-
pwdcc crazy-cat pwd default default
48
-
lscc cozy-canary ls secondary* map
57
+
Alias Instance Command Context Working directory Context status
58
+
lscc crazy-cat ls default*map active
59
+
pwdcc crazy-cat pwd default*default active
60
+
lscc cozy-canary ls secondary map inactive
49
61
```
50
62
51
-
The current context is marked with an asterisk.
63
+
The active `default`context is marked with an asterisk. The `Context status` column distinguishes usable aliases in `default` from retained definitions in inactive contexts.
52
64
53
65
The column `Working directory` tells us on which directory of the host the alias will be run. The value `default` means that the alias will be run in the instance default working directory (normally, `/home/ubuntu`). The value `map` means that, in case the host directory from which the user calls the alias is mounted on the instance, the alias will be run on the mounted directory on the instance. The value will be `default` only if the `--no-map-working-directory` argument is present at alias creation.
54
66
@@ -66,9 +78,9 @@ The first way of running an alias is invoking it with `multipass <alias>`, for e
66
78
multipass lscc
67
79
```
68
80
69
-
This command opens a shell into the instance `cozy-canary`, runs `ls` and returns to the host command line, as if it was an `exec` command. Since we have defined two aliases with the same name, `lscc`, the one in the current context will be run.
81
+
This command opens a shell into the instance `crazy-cat`, runs `ls` and returns to the host command line, as if it was an `exec` command. The alias in `default` runs; the definition with the same namein the inactive `secondary`context cannot run.
70
82
71
-
If you want to run an alias outside the current context, you can use a fully-qualified alias name:
83
+
You can also use the fully-qualified name of an alias in `default`:
72
84
73
85
```{code-block} text
74
86
multipass default.lscc
@@ -209,7 +221,7 @@ The `unalias` command accepts many arguments, specifying more than one alias to
209
221
multipass unalias lscc pwdcc
210
222
```
211
223
212
-
You can also use the `--all` option to remove all the defined aliases in the current context at once:
224
+
You can also use the `--all` option to remove all the defined aliases at once, including those in inactive contexts:
Copy file name to clipboardExpand all lines: docs/reference/command-line-interface/alias.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ multipass alias instance:command [name]
11
11
12
12
If `name` is omitted, the alias name defaults to `command`.
13
13
14
-
After running this command, a new alias is defined as running the `command` on the given instance.
14
+
After running this command, a new alias is defined in the `default` context as running the `command` on the given instance. Non-default contexts are inactive; use this command with a unique name to recreate an alias from an inactive context.
15
15
16
16
By default, if the host folder where the alias is being executed is mounted on the instance, the instance's working directory is changed to the mounted directory. This behaviour can be avoided by defining the alias with the option `--no-map-working-directory`.
Copy file name to clipboardExpand all lines: docs/reference/command-line-interface/aliases.md
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,11 +12,13 @@ multipass aliases
12
12
The output will be similar to the following:
13
13
14
14
```{code-block} text
15
-
Alias Instance Command Working directory
16
-
lsrm rewarded-merlin ls default
17
-
topfp flying-pig top map
15
+
Alias Instance Command Context Working directory Context status
16
+
lsrm rewarded-merlin ls default* default active
17
+
topfp flying-pig top default* map active
18
18
```
19
19
20
+
The `default` context is marked with an asterisk and has status `active`; its aliases remain usable. Non-default contexts have status `inactive`. Their definitions remain listed, but their aliases cannot be executed, including through context-qualified names or existing alias scripts.
21
+
20
22
The `Working directory` column tells us the directory of the host where the alias will be run. The value `default` means that the alias will be run in the instance's default working directory (normally, `/home/ubuntu`). The value `map` means that, if the host directory from which the user calls the alias is mounted on the instance, the alias will be run on the mounted directory on the instance.
21
23
22
24
```{note}
@@ -25,6 +27,10 @@ The value will be `default` only if the alias was created with the `--no-map-wor
25
27
26
28
The command can be used in conjunction with the `--format` or `-f` options to specify the desired output format: `csv`, `json`, `table` or `yaml`.
27
29
30
+
CSV output also includes a `Context status` column. JSON and YAML output include a mapping from context names to `active` or `inactive` in `context-status` and `context_status`, respectively. Existing definitions are preserved; the active context is always `default`.
31
+
32
+
To use an inactive alias, recreate its instance and command definition with `multipass alias <instance>:<command> <new-name>`. New aliases are created in `default`. Preserve `--no-map-working-directory` when recreating an alias whose working directory is `default`.
33
+
28
34
```{note}
29
35
The `json`, `csv` and `yaml` formats cover regular output only. Errors and log messages are printed to the standard error stream as plain text, with failures signaled by a non-zero exit status.
Copy file name to clipboardExpand all lines: docs/reference/command-line-interface/prefer.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,10 @@ The `prefer` command is deprecated and will be removed in an upcoming release. U
9
9
10
10
The `prefer` command previously switched alias contexts. It remains recognised during the deprecation period, but returns an error instead of creating or switching contexts.
11
11
12
+
Only the `default` context is active. Its aliases continue to work. Existing non-default contexts are inactive: their definitions remain visible in [`aliases`](/reference/command-line-interface/aliases), but cannot be executed, even using a context-qualified name.
13
+
14
+
To use a definition from an inactive context, recreate it in `default` with [`alias`](/reference/command-line-interface/alias), choosing a unique name. See [Use instance command aliases](/how-to-guides/manage-instances/use-instance-command-aliases) for the migration steps.
15
+
12
16
---
13
17
14
18
The full `multipass help prefer` output explains the available options:
0 commit comments