Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.16

require (
bunnyshell.com/dev v0.7.2
bunnyshell.com/sdk v0.22.2
bunnyshell.com/sdk v0.22.4
github.com/AlecAivazis/survey/v2 v2.3.7
github.com/MakeNowJust/heredoc v1.0.0
github.com/avast/retry-go/v4 v4.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bunnyshell.com/dev v0.7.2 h1:fa0ZvnIAXLVJINCJqo7uenjHmjPrlHmY18Zc8ypo/6E=
bunnyshell.com/dev v0.7.2/go.mod h1:+Xk46UXX9AW0nHrFMdO/IwpUPfALrck1/qI+LIXsDmE=
bunnyshell.com/sdk v0.22.2 h1:LGJePQTdrBC6YvM282K+1/bw4ohu0XWFQdJN4Drg6l8=
bunnyshell.com/sdk v0.22.2/go.mod h1:RfgfUzZ4WHZGCkToUfu2/hoQS6XsQc8IdPTVAlpS138=
bunnyshell.com/sdk v0.22.4 h1:+arvsU9c8FcYp5GjeN8W78bIuwYndKKMaR6CqGu1EQw=
bunnyshell.com/sdk v0.22.4/go.mod h1:RfgfUzZ4WHZGCkToUfu2/hoQS6XsQc8IdPTVAlpS138=
github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ=
github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo=
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0=
Expand Down
8 changes: 5 additions & 3 deletions pkg/api/environment/action_delete.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package environment

import (
"github.com/spf13/pflag"
"net/http"

"github.com/spf13/pflag"

"bunnyshell.com/cli/pkg/api"
"bunnyshell.com/cli/pkg/api/common"
"bunnyshell.com/cli/pkg/lib"
Expand All @@ -26,7 +27,7 @@ func NewDeleteOptions(id string) *DeleteOptions {
func (options *DeleteOptions) UpdateFlagSet(flags *pflag.FlagSet) {
options.ActionOptions.UpdateFlagSet(flags)

//flags.BoolVar(&options.QueueIfSomethingInProgress, "queue", options.QueueIfSomethingInProgress, "Queue the delete pipeline if another operation is in progress now")
flags.BoolVar(&options.QueueIfSomethingInProgress, "queue", options.QueueIfSomethingInProgress, "Queue the delete pipeline if another operation is in progress now")
}

func Delete(options *DeleteOptions) (*sdk.EventItem, error) {
Expand All @@ -44,7 +45,8 @@ func DeleteRaw(options *DeleteOptions) (*sdk.EventItem, *http.Response, error) {
ctx, cancel := lib.GetContextFromProfile(profile)
defer cancel()

request := lib.GetAPIFromProfile(profile).EnvironmentAPI.EnvironmentDelete(ctx, options.ID)
request := lib.GetAPIFromProfile(profile).EnvironmentAPI.EnvironmentDelete(ctx, options.ID).
QueueIfSomethingInProgress(options.QueueIfSomethingInProgress)

return request.Execute()
}
17 changes: 11 additions & 6 deletions pkg/api/environment/action_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,33 @@ package environment
import (
"net/http"

"github.com/spf13/pflag"

"bunnyshell.com/cli/pkg/api"
"bunnyshell.com/cli/pkg/api/common"
"bunnyshell.com/cli/pkg/lib"
"bunnyshell.com/sdk"
"github.com/spf13/pflag"
)

type StartOptions struct {
common.PartialActionOptions

WithDependencies bool
WithDependencies bool
QueueIfSomethingInProgress bool
}

func NewStartOptions(id string) *StartOptions {
return &StartOptions{
PartialActionOptions: *common.NewPartialActionOptions(id),
PartialActionOptions: *common.NewPartialActionOptions(id),
QueueIfSomethingInProgress: false,
}
}

func (options *StartOptions) UpdateFlagSet(flags *pflag.FlagSet) {
options.PartialActionOptions.UpdateFlagSet(flags)

flags.BoolVar(&options.WithDependencies, "with-dependencies", options.WithDependencies, "Start the component dependencies too.")
flags.BoolVar(&options.QueueIfSomethingInProgress, "queue", options.QueueIfSomethingInProgress, "Queue the start pipeline if another operation is in progress now")
}

func Start(options *StartOptions) (*sdk.EventItem, error) {
Expand All @@ -47,9 +51,10 @@ func StartRaw(options *StartOptions) (*sdk.EventItem, *http.Response, error) {

request := lib.GetAPIFromProfile(profile).EnvironmentAPI.EnvironmentStart(ctx, options.ID).
EnvironmentPartialStartAction(sdk.EnvironmentPartialStartAction{
IsPartial: &isPartialAction,
Components: options.GetActionComponents(),
WithDependencies: &options.WithDependencies,
IsPartial: &isPartialAction,
Components: options.GetActionComponents(),
WithDependencies: &options.WithDependencies,
QueueIfSomethingInProgress: &options.QueueIfSomethingInProgress,
})

return request.Execute()
Expand Down
20 changes: 16 additions & 4 deletions pkg/api/environment/action_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package environment
import (
"net/http"

"github.com/spf13/pflag"

"bunnyshell.com/cli/pkg/api"
"bunnyshell.com/cli/pkg/api/common"
"bunnyshell.com/cli/pkg/lib"
Expand All @@ -11,14 +13,23 @@ import (

type StopOptions struct {
common.PartialActionOptions

QueueIfSomethingInProgress bool
}

func NewStopOptions(id string) *StopOptions {
return &StopOptions{
PartialActionOptions: *common.NewPartialActionOptions(id),
PartialActionOptions: *common.NewPartialActionOptions(id),
QueueIfSomethingInProgress: false,
}
}

func (options *StopOptions) UpdateFlagSet(flags *pflag.FlagSet) {
options.PartialActionOptions.UpdateFlagSet(flags)

flags.BoolVar(&options.QueueIfSomethingInProgress, "queue", options.QueueIfSomethingInProgress, "Queue the stop pipeline if another operation is in progress now")
}

func Stop(options *StopOptions) (*sdk.EventItem, error) {
model, resp, err := StopRaw(options)
if err != nil {
Expand All @@ -37,9 +48,10 @@ func StopRaw(options *StopOptions) (*sdk.EventItem, *http.Response, error) {
isPartialAction := options.IsPartial()

request := lib.GetAPIFromProfile(profile).EnvironmentAPI.EnvironmentStop(ctx, options.ID).
EnvironmentPartialAction(sdk.EnvironmentPartialAction{
IsPartial: &isPartialAction,
Components: options.GetActionComponents(),
EnvironmentPartialStopAction(sdk.EnvironmentPartialStopAction{
IsPartial: &isPartialAction,
Components: options.GetActionComponents(),
QueueIfSomethingInProgress: &options.QueueIfSomethingInProgress,
})

return request.Execute()
Expand Down
Loading