Files
orchard/internal/command/context/delete.go
Nikolay Edigaryev 5c3b47a247 --help fixes and new "orchard logs vm" command (#41)
* 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.
2023-03-23 15:59:57 +04:00

29 lines
492 B
Go

package context
import (
"github.com/cirruslabs/orchard/internal/config"
"github.com/spf13/cobra"
)
func newDeleteCommand() *cobra.Command {
command := &cobra.Command{
Use: "delete NAME",
Short: "Delete a context",
Args: cobra.ExactArgs(1),
RunE: runDelete,
}
return command
}
func runDelete(cmd *cobra.Command, args []string) error {
name := args[0]
configHandle, err := config.NewHandle()
if err != nil {
return err
}
return configHandle.DeleteContext(name)
}