Skip to content

Commit

Permalink
Merge pull request #1300 from onflow/ianthpun/1271-scaffold-id
Browse files Browse the repository at this point in the history
add scaffold id in as a flag
  • Loading branch information
ianthpun authored Dec 13, 2023
2 parents 5c23e21 + 58cc939 commit cfc51e9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/super/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ import (
)

type flagsSetup struct {
Scaffold bool `default:"" flag:"scaffold" info:"Use provided scaffolds for project creation"`
Scaffold bool `default:"" flag:"scaffold" info:"Interactively select a provided scaffold for project creation"`
ScaffoldID int `default:"" flag:"scaffold-id" info:"Use provided scaffold ID for project creation"`
}

var setupFlags = flagsSetup{}
Expand Down Expand Up @@ -88,6 +89,13 @@ func create(
// default to first scaffold - basic scaffold
pickedScaffold := scaffolds[0]

if setupFlags.ScaffoldID != 0 {
if setupFlags.ScaffoldID > len(scaffolds) {
return nil, fmt.Errorf("scaffold with id %d does not exist", setupFlags.ScaffoldID)
}
pickedScaffold = scaffolds[setupFlags.ScaffoldID-1]
}

if setupFlags.Scaffold {
scaffoldItems := make([]util.ScaffoldItem, 0)
for i, s := range scaffolds {
Expand Down

0 comments on commit cfc51e9

Please sign in to comment.