Skip to content

Commit 294568d

Browse files
authored
fix: allow tool to be provided as a flag (#867)
1 parent be0ab1d commit 294568d

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ nitric new --help
5555

5656
Documentation for all available commands:
5757

58+
- nitric add : Add new resources to your Nitric project
59+
- nitric add stack [stackName] [providerName] : Create a new Nitric stack
60+
- nitric add website [websiteName] [toolName] : Add a new website to your Nitric project
5861
- nitric build : Build a Nitric project
5962
- nitric debug : Debug Operations (utilities for debugging nitric applications)
6063
- nitric debug spec : Output the nitric application cloud spec.

cmd/add.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package cmd
1919
import (
2020
"fmt"
2121

22-
tea "github.com/charmbracelet/bubbletea"
2322
"github.com/spf13/afero"
2423
"github.com/spf13/cobra"
2524

@@ -77,7 +76,7 @@ nitric add website my-site astro`,
7776
})
7877
tui.CheckErr(err)
7978

80-
if _, err := teax.NewProgram(websiteModel, tea.WithANSICompressor()).Run(); err != nil {
79+
if _, err := teax.NewProgram(websiteModel).Run(); err != nil {
8180
return err
8281
}
8382

pkg/view/tui/commands/website/new.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,17 @@ func New(fs afero.Fs, args Args) (Model, error) {
177177
if pathInUse {
178178
return Model{}, fmt.Errorf("path %s is already in use", args.WebsitePath)
179179
}
180+
180181
if err := pathValidator(args.WebsitePath); err != nil {
181182
return Model{}, fmt.Errorf("path %s is invalid: %w", args.WebsitePath, err)
182183
}
183184

184185
pathPrompt.SetValue(args.WebsitePath)
185186
pathPrompt.Blur()
186187

187-
step = StepTool
188+
if args.WebsiteName != "" {
189+
step = StepTool
190+
}
188191
}
189192

190193
toolItems := []list.ListItem{}
@@ -205,16 +208,6 @@ func New(fs afero.Fs, args Args) (Model, error) {
205208
}
206209

207210
toolPrompt.SetChoice(tool.Name)
208-
209-
if args.WebsitePath != "" {
210-
if !tool.SkipPackageManagerPrompt {
211-
step = StepPackageManager
212-
} else {
213-
step = StepTool
214-
}
215-
} else {
216-
step = StepPath
217-
}
218211
}
219212

220213
portValidator := validation.ComposeValidators(PortValidators()...)

0 commit comments

Comments
 (0)