Skip to content

Commit

Permalink
[ND-7015] fix components update interactive
Browse files Browse the repository at this point in the history
Signed-off-by: Aris Buzachis <[email protected]>
  • Loading branch information
aris-bunnyshell committed Dec 21, 2023
1 parent 32beb6b commit 38618fc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/component/action/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"bunnyshell.com/cli/pkg/config"
githelper "bunnyshell.com/cli/pkg/helper/git"
"bunnyshell.com/cli/pkg/lib"
"bunnyshell.com/cli/pkg/util"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -97,9 +98,10 @@ func init() {

flags := command.Flags()

flags.AddFlag(options.ServiceComponent.GetRequiredFlag("id"))

flags.StringVar(&editComponentsData.GitTarget, "git-target", editComponentsData.GitTarget, "Target git spec (e.g. https://github.com/fork/templates@main)")
util.MarkFlagRequiredWithHelp(flags.Lookup("git-target"), "The target git spec (e.g. https://github.com/fork/templates@main)")

flags.AddFlag(options.ServiceComponent.GetRequiredFlag("id"))

flags.BoolVar(&editComponentsData.WithDeploy, "deploy", editComponentsData.WithDeploy, "Deploy the environment after update")
flags.StringVar(&editComponentsData.K8SIntegration, "k8s", editComponentsData.K8SIntegration, "Set Kubernetes integration for the environment (if not set)")
Expand Down
7 changes: 7 additions & 0 deletions pkg/helper/git/git_spec.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
package git

import (
"errors"
"net/url"
"strings"
)

var errEmptySpec = errors.New("empty spec")

func ParseGitSec(spec string) (string, string, error) {
if len(spec) == 0 {
return "", "", errEmptySpec
}

if spec[0] == '@' {
return "", spec[1:], nil
}
Expand Down

0 comments on commit 38618fc

Please sign in to comment.