Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove scaffold #1859

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
15 changes: 0 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,21 +161,6 @@ To make the new version the default version that is installed

- **DEPRECATED** Change `version.txt` and commit it. (This file is no longer user for versions of the Flow CLI later than v1.18.0, although it should still be maintained to support older versions of the CLI for a while)

## Adding a scaffold
You can add your own scaffold by creating a GitHub repository containing the scaffold content and then making a PR
to update the `scaffolds.json` in the Flow CLI repository. You need to add an entry to the list
with the bellow content.

```json
{
"name": "name of the scaffold",
"repo": "HTTP URL to the repository containing the scaffold",
"commit": "Hash of the (latest) commit in your scaffold repository",
"branch": "scaffold repository branch",
"description": "user friendly description of the scaffold (what it contains, why it is used...)"
}
```


# CLI Guidelines
This is a design guideline used for the development of the Flow CLI. The purpose of this guideline is to achieve consistency across new features and allow composability of commands that build the fundamentals of great CLI design.
Expand Down
69 changes: 0 additions & 69 deletions internal/prompt/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,75 +728,6 @@ func InstallPathPrompt(defaultPath string) string {
return filepath.Clean(install)
}

type ScaffoldItem struct {
Index int
Title string
Category string
assignedIndex int
}

func ScaffoldPrompt(logger output.Logger, scaffoldItems []ScaffoldItem) int {
const (
general = ""
mobile = "mobile"
web = "web"
unity = "unity"
)
outputType := map[string]string{
general: "🔨 General Scaffolds",
mobile: "📱 Mobile Scaffolds",
web: "💻 Web Scaffolds",
unity: "🏀 Unity Scaffolds",
}

index := 0
outputCategory := func(category string, items []ScaffoldItem) {
logger.Info(output.Bold(output.Magenta(outputType[category])))
for i := range items {
if items[i].Category == category {
index++
logger.Info(fmt.Sprintf(" [%d] %s", index, items[i].Title))
items[i].assignedIndex = index
}
}
logger.Info("")
}

outputCategory(general, scaffoldItems)
outputCategory(web, scaffoldItems)
outputCategory(mobile, scaffoldItems)
outputCategory(unity, scaffoldItems)

prompt := promptui.Prompt{
Label: "Enter the scaffold number",
Validate: func(s string) error {
n, err := strconv.Atoi(s)
if err != nil {
return fmt.Errorf("input must be a number")
}

if n < 0 && n > len(scaffoldItems) {
return fmt.Errorf("not a valid number")
}
return nil
},
}

input, err := prompt.Run()
if err == promptui.ErrInterrupt {
os.Exit(-1)
}
num, _ := strconv.Atoi(input)

for _, item := range scaffoldItems {
if item.assignedIndex == num {
return item.Index
}
}

return 0
}

func GenericBoolPrompt(msg string) bool {
prompt := promptui.Select{
Label: msg,
Expand Down
188 changes: 0 additions & 188 deletions internal/super/scaffolds.go

This file was deleted.

14 changes: 1 addition & 13 deletions internal/super/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ import (

type flagsSetup struct {
ConfigOnly bool `default:"false" flag:"config-only" info:"Only create a flow.json default config"`
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 @@ -73,17 +71,7 @@ func create(
var targetDir string
var err error

if setupFlags.Scaffold || setupFlags.ScaffoldID != 0 {
// Error if no project name is given
if len(args) < 1 || args[0] == "" {
return nil, fmt.Errorf("no project name provided")
}

targetDir, err = handleScaffold(args[0], logger)
if err != nil {
return nil, err
}
} else if setupFlags.ConfigOnly {
if setupFlags.ConfigOnly {
if len(args) > 0 {
return nil, fmt.Errorf("project name not required when using --config-only flag")
}
Expand Down
21 changes: 0 additions & 21 deletions scaffolds.json

This file was deleted.

Loading