Documentation ¶
Overview ¶
Copyright © 2023 Adharsh M dev@adharsh.in
Copyright © 2023 Adharsh M dev@adharsh.in
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GenerateCmd = &cobra.Command{ Use: "generate", Short: "Generate a project with gsk and clean architecture.", Args: cobra.MaximumNArgs(1), Run: func(cmd *cobra.Command, args []string) { log.Println("Generating project files...") isGoModule := project.IsGoModule() isGitRepo := project.IsGitRepo() pkg := getPackageName(args) app := getAppNameFromPkgName(pkg) workdir := "." err := openDirectory(workdir) if err != nil { log.Fatal(err) return } config := &project.Config{ RootPath: workdir, PkgName: pkg, AppName: app, ModName: "ping", ExportedName: "Ping", IsGoModule: isGoModule, IsGitRepo: isGitRepo, } generator := project.NewGenerator(config) err = generator.GenerateProject() if err != nil { log.Fatal(err) return } log.Println("Project generated successfully.") }, }
View Source
var ModuleCmd = &cobra.Command{ Use: "module", Short: "Generate a module for project with gsk and clean architecture.", Args: cobra.MinimumNArgs(1), Run: func(cmd *cobra.Command, args []string) { log.Println("Generating module files...") isGoModule := project.IsGoModule() isGitRepo := project.IsGitRepo() pkg := getPackageName(args) app := getAppNameFromPkgName(pkg) module := getModuleNameFromArgs(args) if module == "" { log.Fatal("Module name is required.") return } workdir := "." err := openDirectory(workdir) if err != nil { log.Fatal(err) return } modConfig := &project.Config{ RootPath: workdir, PkgName: pkg, AppName: app, ModName: module, ExportedName: strcase.ToCamel(module), IsGoModule: isGoModule, IsGitRepo: isGitRepo, } generator := project.NewGenerator(modConfig) err = generator.GenerateModule() if err != nil { log.Fatal(err) return } log.Println("Generated module files.") }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.