Documentation
¶
Overview ¶
Package project provides the functionality for creating a new Go project.
Package project provides the functionality for creating a new Go project.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
SupportedWebframeworks = []string{"chi", "echo", "fiber", "gin", "gorilla/mux", "httpRouter", "standard-library"}
)
Web framework dependencies, and supported web-frameworks
Functions ¶
func IsValidWebFramework ¶
isValidWebFramework check if the input is supported or not
Types ¶
type ProjectConfig ¶
type ProjectConfig struct {
ProjectName string
ProjectType string // Can be an api or serverless.
FrameworkMap map[string]WebFramework // Can be any of the suggested router Packages.
Exit bool
AbsolutePath string
}
ProjectConfig represents the configuration for a new Go project. It includes the project name, type, a map of web frameworks, a flag to indicate whether to exit the CLI, and the absolute path of the project.
func (*ProjectConfig) CreateMainFile ¶
func (p *ProjectConfig) CreateMainFile() error
Todo: Decompose this function into smaller ones. CreateMainFile creates the main file for the project. It creates the project directory, initializes the Go module, installs the dependencies, creates the necessary paths and files, and formats the Go code.
func (*ProjectConfig) ExitCLI ¶
func (p *ProjectConfig) ExitCLI(tprogram *tea.Program)
ExitCLI releases the terminal and exits the program if the Exit flag is set.
type TemplateGenerator ¶
TemplateGenerator is an interface that defines the methods for generating templates for the main, server, and routes files.
type WebFramework ¶
type WebFramework struct {
// contains filtered or unexported fields
}
WebFramework represents a web framework that can be used in the project. It includes the dependencies of the framework and a template generator.