mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-09-30 20:11:20 +02:00
* Make sure we list names/VM names as required argument in the --help * Introduce "orchard logs vm" command * Make sure each command has a Short field * Future-proof port-forward, ssh and vnc commands To support not only the VM resource.
29 lines
539 B
Go
29 lines
539 B
Go
package context
|
|
|
|
import (
|
|
"github.com/cirruslabs/orchard/internal/config"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func newDefaultCommand() *cobra.Command {
|
|
command := &cobra.Command{
|
|
Use: "default NAME",
|
|
Short: "Set a default context to use for client/worker commands",
|
|
Args: cobra.ExactArgs(1),
|
|
RunE: runDefault,
|
|
}
|
|
|
|
return command
|
|
}
|
|
|
|
func runDefault(cmd *cobra.Command, args []string) error {
|
|
name := args[0]
|
|
|
|
configHandle, err := config.NewHandle()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return configHandle.SetDefaultContext(name)
|
|
}
|