Commit 685449f
committed
cli/command/context: allow context show to print context, even on error
This allows the user to still see what context is _set_ in cases where it
does not exist;
docker context show
nosuchcontext
load context "nosuchcontext": context does not exist: open /root/.docker/contexts/meta/8bfef2a74c7d06add4bf4c73b0af97d9f79c76fe151ae0e18b9d7e57104c149b/meta.json: no such file or directory
The error is printed on stderr, so can be redirected:
docker context show 2> /dev/null
nosuchcontext
echo $?
1
This can help in cases where the context is used to (e.g.) set the command-prompt,
but the user removed the context. With this change, the context name can still be
shown, but commands that _require_ the context will still fail.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>1 parent 96e97de commit 685449f
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
33 | 33 | | |
34 | 34 | | |
0 commit comments