SaveStateForCurrentCommand saves state using the current config context
()
| 181 | |
| 182 | // SaveStateForCurrentCommand saves state using the current config context |
| 183 | func SaveStateForCurrentCommand() error { |
| 184 | sm := GetStateManagerForCurrentCommand() |
| 185 | configFile := activeConfigFileForState() |
| 186 | |
| 187 | // Update config file path in state when a config file is active. |
| 188 | if configFile != "" { |
| 189 | currentState := sm.GetState() |
| 190 | sm.SetConfig(configFile, currentState.KubeconfigPath, currentState.ClusterMode) |
| 191 | } |
| 192 | |
| 193 | return sm.Save() |
| 194 | } |
| 195 | |
| 196 | // GetCurrentState returns the state for the current config context |
| 197 | func GetCurrentState() *state.State { |