rebrand app

This commit is contained in:
steven carpenter 2025-07-22 03:15:31 -04:00
parent d5762330da
commit 109c54f1e5
5 changed files with 10 additions and 14 deletions

View file

@ -4,7 +4,7 @@ import (
"log" "log"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"specCon18/wand-templater/render" "specCon18/bubblewand/render"
) )
// CLI flag variables // CLI flag variables
@ -18,8 +18,8 @@ var (
// rootCmd renders templates using CLI flags // rootCmd renders templates using CLI flags
var rootCmd = &cobra.Command{ var rootCmd = &cobra.Command{
Use: "wand-templater", Use: "bubblewand",
Short: "A tool to generate a go project template for building a terminal application with bubbletea + cobra + viper + log + mango", Short: "A tool to generate a go project template for building a terminal application with bubbletea + cobra + viper + log",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
// Fill ProgramData from CLI input // Fill ProgramData from CLI input
data := render.ProgramData{ data := render.ProgramData{

View file

@ -5,13 +5,13 @@ import (
"github.com/charmbracelet/huh" "github.com/charmbracelet/huh"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"specCon18/wand-templater/render" "specCon18/bubblewand/render"
) )
// tuiCmd renders templates interactively via a form // tuiCmd renders templates interactively via a form
var tuiCmd = &cobra.Command{ var tuiCmd = &cobra.Command{
Use: "tui", Use: "tui",
Short: "an interactive TUI for generating a go module template for terminal applications using bubbletea + cobra + viper + log + mango", Short: "an interactive TUI for generating a go module template for terminal applications using bubbletea + cobra + viper + log",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
var data render.ProgramData var data render.ProgramData
@ -22,6 +22,7 @@ var tuiCmd = &cobra.Command{
huh.NewInput().Title("Package Name").Placeholder("e.g. myapp").Value(&data.PackageName), huh.NewInput().Title("Package Name").Placeholder("e.g. myapp").Value(&data.PackageName),
huh.NewInput().Title("Program Version").Placeholder("e.g. 1.0.0").Value(&data.ProgramVersion), huh.NewInput().Title("Program Version").Placeholder("e.g. 1.0.0").Value(&data.ProgramVersion),
huh.NewInput().Title("Program Description").Placeholder("Describe your program").Value(&data.ProgramDesc), huh.NewInput().Title("Program Description").Placeholder("Describe your program").Value(&data.ProgramDesc),
huh.NewInput().Title("Output Directory").Placeholder("Where to output your templated project").Value(&data.OutputDir),
), ),
) )
@ -30,19 +31,14 @@ var tuiCmd = &cobra.Command{
log.Fatalf("form cancelled or failed: %v", err) log.Fatalf("form cancelled or failed: %v", err)
} }
// Retrieve --output flag value
out, _ := cmd.Flags().GetString("output")
// Render templates with user input // Render templates with user input
if err := render.RenderTemplates(data, out); err != nil { if err := render.RenderTemplates(data, data.OutputDir); err != nil {
log.Fatalf("rendering failed: %v", err) log.Fatalf("rendering failed: %v", err)
} }
}, },
} }
func init() { func init() {
// Allow output dir override
tuiCmd.Flags().StringP("output", "o", "output", "Output directory for rendered files")
rootCmd.AddCommand(tuiCmd) rootCmd.AddCommand(tuiCmd)
} }

3
go.mod
View file

@ -1,5 +1,4 @@
module specCon18/wand-templater module specCon18/bubblewand
go 1.23.11 go 1.23.11
require ( require (

View file

@ -1,7 +1,7 @@
package main package main
import ( import (
"specCon18/wand-templater/cmd" "specCon18/bubblewand/cmd"
) )
func main() { func main() {

View file

@ -14,6 +14,7 @@ type ProgramData struct {
PackageName string PackageName string
ProgramVersion string ProgramVersion string
ProgramDesc string ProgramDesc string
OutputDir string
} }
// RenderTemplates renders all .tmpl files from the templates/ directory into outputDir // RenderTemplates renders all .tmpl files from the templates/ directory into outputDir