Skip to content

Commit

Permalink
Auto-activate created context (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
thcyron authored and thetechnick committed Jan 22, 2018
1 parent 0e11fde commit 02630c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changes

## master

* Auto-activate created context on `hcloud context create`
* Fix `hcloud version` not showing correct version
7 changes: 4 additions & 3 deletions context_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ func runContextCreate(cli *CLI, cmd *cobra.Command, args []string) error {
}

cli.Config.Contexts = append(cli.Config.Contexts, context)
if len(cli.Config.Contexts) == 1 {
cli.Config.ActiveContext = context
}
cli.Config.ActiveContext = context

if err := cli.WriteConfig(); err != nil {
return err
}

fmt.Printf("Context %s created and activated\n", name)

return nil
}

0 comments on commit 02630c9

Please sign in to comment.