refactor: use new internal arg failure func

This commit is contained in:
2021-08-03 13:57:12 +02:00
parent 43238d379c
commit 471c982f63
4 changed files with 15 additions and 6 deletions

View File

@ -4,12 +4,14 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"time"
"coopcloud.tech/abra/cli/formatter"
"coopcloud.tech/abra/cli/internal"
"github.com/hetznercloud/hcloud-go/hcloud"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
@ -73,7 +75,7 @@ environment variable or otherwise passing the "--env/-e" flag.
Action: func(c *cli.Context) error {
name := c.Args().First()
if name == "" {
return cli.ShowSubcommandHelp(c)
internal.ShowSubcommandHelpAndError(c, errors.New("no name provided"))
}
if hetznerCloudAPIToken == "" {
@ -176,7 +178,7 @@ environment variable or otherwise passing the "--env/-e" flag.
Action: func(c *cli.Context) error {
name := c.Args().First()
if name == "" {
return cli.ShowSubcommandHelp(c)
internal.ShowSubcommandHelpAndError(c, errors.New("no name provided"))
}
if capsulAPIToken == "" {