Skip to content

Commit 38618fc

Browse files
[ND-7015] fix components update interactive
Signed-off-by: Aris Buzachis <aris.buzachis@bunnyshell.com>
1 parent 32beb6b commit 38618fc

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

cmd/component/action/update.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"bunnyshell.com/cli/pkg/config"
1212
githelper "bunnyshell.com/cli/pkg/helper/git"
1313
"bunnyshell.com/cli/pkg/lib"
14+
"bunnyshell.com/cli/pkg/util"
1415
"github.com/spf13/cobra"
1516
)
1617

@@ -97,9 +98,10 @@ func init() {
9798

9899
flags := command.Flags()
99100

100-
flags.AddFlag(options.ServiceComponent.GetRequiredFlag("id"))
101-
102101
flags.StringVar(&editComponentsData.GitTarget, "git-target", editComponentsData.GitTarget, "Target git spec (e.g. https://github.com/fork/templates@main)")
102+
util.MarkFlagRequiredWithHelp(flags.Lookup("git-target"), "The target git spec (e.g. https://github.com/fork/templates@main)")
103+
104+
flags.AddFlag(options.ServiceComponent.GetRequiredFlag("id"))
103105

104106
flags.BoolVar(&editComponentsData.WithDeploy, "deploy", editComponentsData.WithDeploy, "Deploy the environment after update")
105107
flags.StringVar(&editComponentsData.K8SIntegration, "k8s", editComponentsData.K8SIntegration, "Set Kubernetes integration for the environment (if not set)")

pkg/helper/git/git_spec.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
package git
22

33
import (
4+
"errors"
45
"net/url"
56
"strings"
67
)
78

9+
var errEmptySpec = errors.New("empty spec")
10+
811
func ParseGitSec(spec string) (string, string, error) {
12+
if len(spec) == 0 {
13+
return "", "", errEmptySpec
14+
}
15+
916
if spec[0] == '@' {
1017
return "", spec[1:], nil
1118
}

0 commit comments

Comments
 (0)