fix(simapp): home flag is not respected (backport #18994) (#19297)

Co-authored-by: Connor Davis <17688291+PoisonPhang@users.noreply.github.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
mergify[bot]
2024-01-30 21:53:35 +00:00
committed by GitHub
co-authored by Connor Davis Julien Robert
parent a4bd70895d
commit d2f9634443
4 changed files with 13 additions and 5 deletions
+9 -1
View File
@@ -359,6 +359,14 @@ func GetClientContextFromCmd(cmd *cobra.Command) Context {
// SetCmdClientContext sets a command's Context value to the provided argument.
// If the context has not been set, set the given context as the default.
func SetCmdClientContext(cmd *cobra.Command, clientCtx Context) error {
cmd.SetContext(context.WithValue(cmd.Context(), ClientContextKey, &clientCtx))
var cmdCtx context.Context
if cmd.Context() == nil {
cmdCtx = context.Background()
} else {
cmdCtx = cmd.Context()
}
cmd.SetContext(context.WithValue(cmdCtx, ClientContextKey, &clientCtx))
return nil
}