Skip to content

Commit

Permalink
introduce last for breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
widmogrod committed Nov 10, 2023
1 parent 1ffcef9 commit 904c405
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
18 changes: 8 additions & 10 deletions cmd/mkunion/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ func main() {

var app *cli.App
app = &cli.App{
Name: mkunion.Program,
Description: "VisitorGenerator union type and visitor pattern gor golang",
EnableBashCompletion: true,
//DefaultCommand: "union",
Name: mkunion.Program,
Description: "VisitorGenerator union type and visitor pattern gor golang",
EnableBashCompletion: true,
UseShortOptionHandling: true,
Flags: []cli.Flag{
&cli.StringSliceFlag{
Expand All @@ -41,7 +40,7 @@ func main() {
&cli.StringFlag{
Name: "skip-extension",
Aliases: []string{"skip-ext"},
Value: "reducer_dfs,reducer_bfs,default_visitor,default_reducer",
Value: "reducer_bfs,reducer_dfs,default_visitor,default_reducer",
Required: false,
},
&cli.StringFlag{
Expand Down Expand Up @@ -161,14 +160,13 @@ func main() {
skipExtension := strings.Split(c.String("skip-extension"), ",")
includeExtension := strings.Split(c.String("include-extension"), ",")
if len(includeExtension) > 0 {
for _, name := range includeExtension {
// skip if already included in skipExtension, remove from skipExtension
for i, skip := range skipExtension {
if skip == name {
for _, includeName := range includeExtension {
for i, skipName := range skipExtension {
if skipName == includeName {
log.Infof("include extension, that was skipName %s", includeName)
skipExtension = append(skipExtension[:i], skipExtension[i+1:]...)
}
}
// otherwise, cannot include extension other than existing ones
}
}

Expand Down
2 changes: 1 addition & 1 deletion example/tree_example.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package example

//go:generate go run ../cmd/mkunion/main.go -name=Tree
//go:generate go run ../cmd/mkunion/main.go -name=Tree -include-extension=reducer_bfs,reducer_dfs,default_visitor,default_reducer
type (
Branch struct{ L, R Tree }
Leaf struct{ Value int }
Expand Down

0 comments on commit 904c405

Please sign in to comment.