Skip to content

Commit 2003df9

Browse files
author
Guillaume Bouvignies
authored
feat: Noop when switching to current context (#390)
## Description: Not do anything when running `context switch` to the context we're already on ## Is this change user facing? NO <!-- If yes, please add the "user facing" label to the PR --> <!-- If yes, don't forget to include docs changes where relevant --> ## References (if applicable): <!-- Add relevant Github Issues, Discord threads, or other helpful information. -->
1 parent f9083cc commit 2003df9

File tree

1 file changed

+5
-0
lines changed
  • cli/cli/commands/kurtosis_context/context_switch

1 file changed

+5
-0
lines changed

cli/cli/commands/kurtosis_context/context_switch/switch.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ func run(ctx context.Context, _ *flags.ParsedFlags, args *args.ParsedArgs) error
6969
return stacktrace.NewError("No context matching identifier '%s' could be found", contextIdentifier)
7070
}
7171

72+
if contextUuidToSwitchTo.GetValue() == contextPriorToSwitch.GetUuid().GetValue() {
73+
logrus.Infof("Already on context '%s'", contextPriorToSwitch.GetName())
74+
return nil
75+
}
76+
7277
if err = contextsConfigStore.SwitchContext(contextUuidToSwitchTo); err != nil {
7378
return stacktrace.Propagate(err, "An error occurred switching to context '%s' with UUID '%s'", contextIdentifier, contextUuidToSwitchTo.GetValue())
7479
}

0 commit comments

Comments
 (0)