-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add the possibility to trigger environment partial actions
Signed-off-by: Aris Buzachis <[email protected]>
- Loading branch information
1 parent
8c1b0e0
commit 9201a8d
Showing
12 changed files
with
106 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package common | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/spf13/pflag" | ||
) | ||
|
||
var componentsList string | ||
|
||
type PartialActionOptions struct { | ||
ActionOptions | ||
|
||
IsPartial bool | ||
Components []string | ||
} | ||
|
||
func NewPartialActionOptions(id string, isPartial bool, components []string) *PartialActionOptions { | ||
return &PartialActionOptions{ | ||
ActionOptions: *NewActionOptions(id), | ||
|
||
IsPartial: isPartial, | ||
Components: components, | ||
} | ||
} | ||
|
||
func (pao *PartialActionOptions) UpdateFlagSet(flags *pflag.FlagSet) { | ||
pao.ActionOptions.UpdateFlagSet(flags) | ||
|
||
flags.StringVar(&componentsList, "components", componentsList, "Execute a partial action with the set components (comma separated names)") | ||
} | ||
|
||
func (pao *PartialActionOptions) ProcessCommand(cmd *cobra.Command) { | ||
pao.IsPartial = cmd.Flags().Lookup("components").Changed | ||
|
||
if pao.IsPartial { | ||
pao.Components = strings.Split(componentsList, ",") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters