diff --git a/.github/workflows/generate-linter.yml b/.github/workflows/generate-linter.yml index 090b96fb..ae2fe55d 100644 --- a/.github/workflows/generate-linter.yml +++ b/.github/workflows/generate-linter.yml @@ -22,14 +22,13 @@ jobs: matrix: framework: [chi, gin, fiber, gorilla/mux, httprouter, standard-library, echo] - driver: - [mysql, postgres, sqlite, mongo, none] + driver: [mysql, postgres, sqlite, mongo, none] goVersion: ["1.20"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: build templates - run: go run main.go create -n ${{ matrix.framework }} -f ${{ matrix.framework}} -d ${{ matrix.driver }} + run: script -q /dev/null -c "go run main.go create -n ${{ matrix.framework }} -f ${{ matrix.framework}} -d ${{matrix.driver}}" /dev/null - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: diff --git a/cmd/create.go b/cmd/create.go index d5e760cf..eeaecb2d 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -155,23 +155,22 @@ var createCmd = &cobra.Command{ } project.AbsolutePath = currentWorkingDir spinner := tea.NewProgram(spinner.InitialModelNew()) + // add synchronization to wait for spinner to finish wg := sync.WaitGroup{} wg.Add(1) go func() { defer wg.Done() - // only run the spinner if the command is interactive - if isInteractive { - if _, err := spinner.Run(); err != nil { - cobra.CheckErr(err) - } + if _, err := spinner.Run(); err != nil { + cobra.CheckErr(err) } }() + err = project.CreateMainFile() + // once the create is done, stop the spinner - if isInteractive { - spinner.Quit() - } + spinner.Quit() + // wait for the spinner to finish wg.Wait() if err != nil { diff --git a/cmd/ui/spinner/spinner.go b/cmd/ui/spinner/spinner.go index 4fa0b940..4a567785 100644 --- a/cmd/ui/spinner/spinner.go +++ b/cmd/ui/spinner/spinner.go @@ -54,7 +54,7 @@ func (m model) View() string { if m.err != nil { return m.err.Error() } - str := fmt.Sprintf("\n\n %s Preparing...\n\n", m.spinner.View()) + str := fmt.Sprintf("%s Preparing...", m.spinner.View()) if m.quitting { return str + "\n" }