abra/cli/server/remove.go

32 lines
709 B
Go
Raw Normal View History

package server
import (
"errors"
"coopcloud.tech/abra/cli/internal"
"coopcloud.tech/abra/client"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
)
var serverRemoveCommand = &cli.Command{
2021-09-04 23:34:56 +00:00
Name: "remove",
Aliases: []string{"rm"},
Usage: "Remove a server",
Description: `
This does not destroy the actual server. It simply removes it from Abra
internal bookkeeping so that it is not managed any more.
`,
HideHelp: true,
Action: func(c *cli.Context) error {
server := c.Args().First()
if server == "" {
internal.ShowSubcommandHelpAndError(c, errors.New("no server provided"))
}
if err := client.DeleteContext(server); err != nil {
logrus.Fatal(err)
}
return nil
},
}