rebrand app
This commit is contained in:
parent
d5762330da
commit
109c54f1e5
5 changed files with 10 additions and 14 deletions
|
|
@ -4,7 +4,7 @@ import (
|
|||
"log"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"specCon18/wand-templater/render"
|
||||
"specCon18/bubblewand/render"
|
||||
)
|
||||
|
||||
// CLI flag variables
|
||||
|
|
@ -18,8 +18,8 @@ var (
|
|||
|
||||
// rootCmd renders templates using CLI flags
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "wand-templater",
|
||||
Short: "A tool to generate a go project template for building a terminal application with bubbletea + cobra + viper + log + mango",
|
||||
Use: "bubblewand",
|
||||
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) {
|
||||
// Fill ProgramData from CLI input
|
||||
data := render.ProgramData{
|
||||
|
|
|
|||
12
cmd/tui.go
12
cmd/tui.go
|
|
@ -5,13 +5,13 @@ import (
|
|||
|
||||
"github.com/charmbracelet/huh"
|
||||
"github.com/spf13/cobra"
|
||||
"specCon18/wand-templater/render"
|
||||
"specCon18/bubblewand/render"
|
||||
)
|
||||
|
||||
// tuiCmd renders templates interactively via a form
|
||||
var tuiCmd = &cobra.Command{
|
||||
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) {
|
||||
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("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("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)
|
||||
}
|
||||
|
||||
// Retrieve --output flag value
|
||||
out, _ := cmd.Flags().GetString("output")
|
||||
|
||||
// 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)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
// Allow output dir override
|
||||
tuiCmd.Flags().StringP("output", "o", "output", "Output directory for rendered files")
|
||||
rootCmd.AddCommand(tuiCmd)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue