Skip to content

Commit

Permalink
Add custom flags
Browse files Browse the repository at this point in the history
  • Loading branch information
anilsenay committed Sep 28, 2023
1 parent 1f58f8d commit af19906
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/
12 changes: 12 additions & 0 deletions cmd/gonew.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func main() {
log.SetPrefix("gonew: ")
log.SetFlags(0)
flag.Usage = usage

srcModuleName := flag.String("srcmod", "", "source module name in go.mod file")
dstModuleName := flag.String("dstmod", "", "destination module name in go.mod file")

flag.Parse()
args := flag.Args()

Expand Down Expand Up @@ -123,6 +127,14 @@ func main() {
}
}

// Set custom module name
if *srcModuleName != "" {
srcMod = *srcModuleName
}
if *dstModuleName != "" {
dstMod = *dstModuleName
}

// Copy from module cache into new directory, making edits as needed.
filepath.WalkDir(info.Dir, func(src string, d fs.DirEntry, err error) error {
if err != nil {
Expand Down

0 comments on commit af19906

Please sign in to comment.