add create functionnality
This commit is contained in:
parent
03ddddd2e2
commit
71fe930228
1
.gitignore
vendored
1
.gitignore
vendored
@ -0,0 +1 @@
|
|||||||
|
release/
|
87
Taskfile.yml
87
Taskfile.yml
@ -2,20 +2,26 @@
|
|||||||
|
|
||||||
version: '3'
|
version: '3'
|
||||||
|
|
||||||
# Variables
|
#### Variables ####
|
||||||
|
# # # # # # # # # #
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
## Commands Go ##
|
#### Commands Go ####
|
||||||
GOCMD: go
|
GOCMD: go
|
||||||
GOBUILD: "{{.GOCMD}} build -o"
|
GOBUILD: "{{.GOCMD}} build -o"
|
||||||
GORUN: "{{.GOCMD}} run"
|
GORUN: "{{.GOCMD}} run"
|
||||||
GOTEST: "{{.GOCMD}} test -v"
|
GOTEST: "{{.GOCMD}} test -v"
|
||||||
GOCOVER: "{{.GOCMD}} test -v --cover"
|
GOCOVER: "{{.GOCMD}} test -v --cover"
|
||||||
|
|
||||||
# Variables to get version
|
#### Variables to get version ####
|
||||||
VERSION:
|
VERSION:
|
||||||
sh: cd version/ && versionManager go version
|
sh: cd version/ && versionManager go version
|
||||||
|
|
||||||
## Binary name of kode-creator ##
|
#### Variable HOME of user ####
|
||||||
|
HOME:
|
||||||
|
sh: echo $HOME
|
||||||
|
|
||||||
|
#### Binary name of kode-creator ####
|
||||||
WINDOWS_BINARY_NAME: ./release/windows/{{.VERSION}}/kode-creator.exe
|
WINDOWS_BINARY_NAME: ./release/windows/{{.VERSION}}/kode-creator.exe
|
||||||
LINUX_BINARY_NAME: ./release/linux/{{.VERSION}}/kode-creator
|
LINUX_BINARY_NAME: ./release/linux/{{.VERSION}}/kode-creator
|
||||||
|
|
||||||
@ -27,27 +33,76 @@ vars:
|
|||||||
# GOARCH: amd64
|
# GOARCH: amd64
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
###### LINUX ######
|
######### L I N U X S E C T I O N ##########
|
||||||
|
# # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
|
|
||||||
|
#### Version Manager ####
|
||||||
## Make sure you have PATH the versionManager !!!
|
## Make sure you have PATH the versionManager !!!
|
||||||
linux-version:
|
1.0-linux-version-build:
|
||||||
cmds:
|
cmds:
|
||||||
- "cd ./version/ && versionManager go build"
|
- "cd ./version/ && versionManager go build"
|
||||||
# silent: true
|
1.1-linux-version-patch:
|
||||||
|
cmds:
|
||||||
|
- "cd ./version/ && versionManager go patch"
|
||||||
|
1.2-linux-version-minor:
|
||||||
|
cmds:
|
||||||
|
- "cd ./version/ && versionManager go minor"
|
||||||
|
1.3-linux-version-major:
|
||||||
|
cmds:
|
||||||
|
- "cd ./version/ && versionManager go major"
|
||||||
|
|
||||||
## Build ##
|
#### Build ####
|
||||||
linux-build:
|
2.0-linux-build:
|
||||||
cmds:
|
cmds:
|
||||||
- "{{.GOBUILD}} {{.LINUX_BINARY_NAME}} -v"
|
- "{{.GOBUILD}} {{.LINUX_BINARY_NAME}} -v"
|
||||||
# silent: true
|
|
||||||
|
|
||||||
## change Build version and build
|
#### change Build, patch, minor or major version and BUILD ####
|
||||||
linux-vbuild:
|
3.0-linux-vbuild:
|
||||||
cmds:
|
cmds:
|
||||||
- task: linux-version
|
- task: 1.0-linux-version-build
|
||||||
- task: linux-build
|
- task: 2.0-linux-build
|
||||||
|
3.1-linux-vpatch:
|
||||||
|
cmds:
|
||||||
|
- task: 1.1-linux-version-patch
|
||||||
|
- task: 2.0-linux-build
|
||||||
|
3.2-linux-vminor:
|
||||||
|
cmds:
|
||||||
|
- task: 1.2-linux-version-minor
|
||||||
|
- task: 2.0-linux-build
|
||||||
|
3.3-linux-vmajor:
|
||||||
|
cmds:
|
||||||
|
- task: 1.3-linux-version-major
|
||||||
|
- task: 2.0-linux-build
|
||||||
|
|
||||||
|
#### install on LINUX OS ####
|
||||||
|
4.0-linux-install:
|
||||||
|
cmds:
|
||||||
|
- "cp {{.LINUX_BINARY_NAME}} {{.HOME}}/dev/outils/kode-creator/"
|
||||||
|
- "chmod +x {{.HOME}}/dev/outils/kode-creator/kode-creator"
|
||||||
|
- "cp ./config.yml {{.HOME}}/dev/outils/kode-creator/"
|
||||||
|
|
||||||
|
#### LINUX - Build ==> Install ####
|
||||||
|
5.0-LINUX-bi:
|
||||||
|
cmds:
|
||||||
|
- task: 3.0-linux-vbuild
|
||||||
|
- task: 4.0-linux-install
|
||||||
|
5.1-LINUX-pi:
|
||||||
|
cmds:
|
||||||
|
- task: 3.1-linux-vpatch
|
||||||
|
- task: 4.0-linux-install
|
||||||
|
5.2-LINUX-mini:
|
||||||
|
cmds:
|
||||||
|
- task: 3.2-linux-vminor
|
||||||
|
- task: 4.0-linux-install
|
||||||
|
5.3-LINUX-maji:
|
||||||
|
cmds:
|
||||||
|
- task: 3.3-linux-vmajor
|
||||||
|
- task: 4.0-linux-install
|
||||||
|
|
||||||
|
|
||||||
|
######### W I N D O W S S E C T I O N ##########
|
||||||
|
# # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
|
|
||||||
###### WINDOWS ######
|
|
||||||
## Make sure you have PATH the versionManager.exe !!!
|
## Make sure you have PATH the versionManager.exe !!!
|
||||||
windows-version:
|
windows-version:
|
||||||
cmds:
|
cmds:
|
||||||
@ -67,3 +122,5 @@ tasks:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@ var CreateCmd = &cobra.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The CreateProject function creates a project structure, including a directory, version control, and
|
||||||
|
// a readme file, based on the provided arguments and flags.
|
||||||
func CreateProject(cmd *cobra.Command, args []string) error {
|
func CreateProject(cmd *cobra.Command, args []string) error {
|
||||||
|
|
||||||
godotenv.Load()
|
godotenv.Load()
|
||||||
@ -65,11 +67,70 @@ func CreateProject(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
fmt.Println("Structure Name:" + data.Name)
|
fmt.Println("Structure Name:" + data.Name)
|
||||||
|
|
||||||
// Make API request to create Github project
|
// if directory flag is set, create structure in current directory
|
||||||
jsonData, _ := json.Marshal(data)
|
if CfgGlobal.GetCreateDirectoryFlag() {
|
||||||
|
|
||||||
|
// Create directory of the project
|
||||||
|
CreateProjectStructure(data)
|
||||||
|
|
||||||
|
// if version flag is set, create version control in project
|
||||||
|
if CfgGlobal.GetCreateVersionFlag() {
|
||||||
|
fmt.Println("==> Creating version control...")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// if readme flag is set, create readme in project
|
||||||
|
if CfgGlobal.GetCreateReadmeFlag() {
|
||||||
|
fmt.Println("==> Creating readme...")
|
||||||
|
isCreated := CreateReadme(name, description, "BC", "")
|
||||||
|
if isCreated {
|
||||||
|
fmt.Println("==> Created README.md")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if github flag is set, create structure in github
|
||||||
|
if CfgGlobal.GetCreateGitFlag() {
|
||||||
|
|
||||||
|
} else if CfgGlobal.GetCreateTeaFlag() {
|
||||||
|
|
||||||
|
err := CreateGiteaProject(data, cmd, args)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// The function creates a directory for a project and changes the current working directory to the
|
||||||
|
// newly created directory.
|
||||||
|
func CreateProjectStructure(project structures.Project) {
|
||||||
|
|
||||||
|
fmt.Println("==> Creating directory...")
|
||||||
|
// Create directory of the project
|
||||||
|
fmt.Println("==> Creating directory...")
|
||||||
|
utils.CreateDir(project.Name)
|
||||||
|
fmt.Println("==> Created directory")
|
||||||
|
|
||||||
|
// Change to project directory
|
||||||
|
err := os.Chdir(project.Name)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The function `CreateGiteaProject` creates a new Gitea project, initializes a Git repository, and
|
||||||
|
// makes an initial commit.
|
||||||
|
func CreateGiteaProject(prj structures.Project, cmd *cobra.Command, args []string) error {
|
||||||
|
|
||||||
|
// Make API request to create Gitea project
|
||||||
|
jsonData, _ := json.Marshal(prj)
|
||||||
|
|
||||||
req, err := http.NewRequest("POST",
|
req, err := http.NewRequest("POST",
|
||||||
fmt.Sprintf("%s/%s/repos", CfgGlobal.GetUrlApiOrgs(), CfgGlobal.GetCreateCmd().Organisation),
|
fmt.Sprintf("%s/%s/repos", CfgGlobal.GetUrlApiOrgs(), CfgGlobal.GetCreateCmd().Organization),
|
||||||
bytes.NewBuffer(jsonData))
|
bytes.NewBuffer(jsonData))
|
||||||
req.Header.Set("Authorization", "token "+CfgGlobal.GetGitTeaTokenEnv())
|
req.Header.Set("Authorization", "token "+CfgGlobal.GetGitTeaTokenEnv())
|
||||||
req.Header.Set("Content-Type", "application/json")
|
req.Header.Set("Content-Type", "application/json")
|
||||||
@ -89,22 +150,6 @@ func CreateProject(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
|
|
||||||
// Create directory of the project
|
|
||||||
fmt.Println("==> Creating directory...")
|
|
||||||
utils.CreateDir(name)
|
|
||||||
fmt.Println("==> Created directory")
|
|
||||||
|
|
||||||
// Change to project directory
|
|
||||||
err = os.Chdir(name)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
isCreated := CreateReadme(name, description, "BC", "")
|
|
||||||
if isCreated {
|
|
||||||
fmt.Println("==> Created README.md")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Git commands
|
// Git commands
|
||||||
gitCmd := exec.Command("git", "init")
|
gitCmd := exec.Command("git", "init")
|
||||||
err = gitCmd.Run()
|
err = gitCmd.Run()
|
||||||
@ -144,4 +189,7 @@ func CreateProject(cmd *cobra.Command, args []string) error {
|
|||||||
fmt.Println(project)
|
fmt.Println(project)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CreateGithubProject() {}
|
||||||
|
15
config.yml
15
config.yml
@ -6,7 +6,7 @@ category:
|
|||||||
software:
|
software:
|
||||||
Go Lang:
|
Go Lang:
|
||||||
name: "Go Lang"
|
name: "Go Lang"
|
||||||
version: "1.17.5"
|
version: "1.19.5"
|
||||||
author: "Google"
|
author: "Google"
|
||||||
location: 'C:\Users\bruno\scoop\apps\go\current'
|
location: 'C:\Users\bruno\scoop\apps\go\current'
|
||||||
description: "Go is an open source programming language that makes it easy to build simple, reliable, and efficient software."
|
description: "Go is an open source programming language that makes it easy to build simple, reliable, and efficient software."
|
||||||
@ -26,11 +26,9 @@ category:
|
|||||||
path:
|
path:
|
||||||
- src/config
|
- src/config
|
||||||
- src/version
|
- src/version
|
||||||
|
|
||||||
test:
|
test:
|
||||||
path:
|
path:
|
||||||
- test
|
- test
|
||||||
|
|
||||||
release:
|
release:
|
||||||
path:
|
path:
|
||||||
- release
|
- release
|
||||||
@ -41,7 +39,16 @@ category:
|
|||||||
# build: "go build"
|
# build: "go build"
|
||||||
# test: "go test"
|
# test: "go test"
|
||||||
# lint: "golint"
|
# lint: "golint"
|
||||||
|
|
||||||
|
install apps:
|
||||||
|
Tasks:
|
||||||
|
name: "Tasks"
|
||||||
|
cmdWin: "scoop install tasks"
|
||||||
|
cmdLinux: "sudo apt-get install tasks"
|
||||||
|
Go:
|
||||||
|
cmd:
|
||||||
|
Win: "scoop install go"
|
||||||
|
Linux: "sudo apt-get install go"
|
||||||
Java:
|
Java:
|
||||||
software:
|
software:
|
||||||
Quarkus:
|
Quarkus:
|
||||||
|
163
config/config.go
163
config/config.go
@ -43,10 +43,16 @@ type ListCmdConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CreateCmdConfig struct {
|
type CreateCmdConfig struct {
|
||||||
Name string
|
Name string
|
||||||
Organisation string
|
Description string
|
||||||
Description string
|
DirectoryFlag bool
|
||||||
Private bool
|
VersionFlag bool
|
||||||
|
ReadmeFlag bool
|
||||||
|
GitFlag bool
|
||||||
|
TeaFlag bool
|
||||||
|
Organization string
|
||||||
|
OrganizationFlag bool
|
||||||
|
PrivateFlag bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type EnvCmdConfig struct {
|
type EnvCmdConfig struct {
|
||||||
@ -323,14 +329,84 @@ func (c *Config) SetCreateDescription(value string) {
|
|||||||
c.CreateCmd.Description = value
|
c.CreateCmd.Description = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Getter for Directory field
|
||||||
|
func (c *Config) GetCreateDirectoryFlag() bool {
|
||||||
|
return c.CreateCmd.DirectoryFlag
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setter for Directory field
|
||||||
|
func (c *Config) SetCreateDirectoryFlag(value bool) {
|
||||||
|
c.CreateCmd.DirectoryFlag = value
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getter for versionFlag field
|
||||||
|
func (c *Config) GetCreateVersionFlag() bool {
|
||||||
|
return c.CreateCmd.VersionFlag
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setter for versionFlag field
|
||||||
|
func (c *Config) SetCreateVersionFlag(value bool) {
|
||||||
|
c.CreateCmd.VersionFlag = value
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getter for createReadme field
|
||||||
|
func (c *Config) GetCreateReadmeFlag() bool {
|
||||||
|
return c.CreateCmd.ReadmeFlag
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setter for createReadme field
|
||||||
|
func (c *Config) SetCreateReadmeFlag(value bool) {
|
||||||
|
c.CreateCmd.ReadmeFlag = value
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getter for createGit flag
|
||||||
|
func (c *Config) GetCreateGitFlag() bool {
|
||||||
|
return c.CreateCmd.GitFlag
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setter for createGit flag
|
||||||
|
func (c *Config) SetCreateGitFlag(value bool) {
|
||||||
|
c.CreateCmd.GitFlag = value
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getter for createTea flag
|
||||||
|
func (c *Config) GetCreateTeaFlag() bool {
|
||||||
|
return c.CreateCmd.TeaFlag
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setter for createTea flag
|
||||||
|
func (c *Config) SetCreateTeaFlag(value bool) {
|
||||||
|
c.CreateCmd.TeaFlag = value
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getter for create Orgenization field
|
||||||
|
func (c *Config) GetCreateOrgenization() string {
|
||||||
|
return c.CreateCmd.Organization
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setter for create Orgenization field
|
||||||
|
func (c *Config) SetCreateOrgenization(value string) {
|
||||||
|
c.CreateCmd.Organization = value
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getter for create Orgenization flag
|
||||||
|
func (c *Config) GetCreateOrgenizationFlag() bool {
|
||||||
|
return c.CreateCmd.OrganizationFlag
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setter for create Orgenization flag
|
||||||
|
func (c *Config) SetCreateOrgenizationFlag(value bool) {
|
||||||
|
c.CreateCmd.OrganizationFlag = value
|
||||||
|
}
|
||||||
|
|
||||||
// Getter for createPrivate field
|
// Getter for createPrivate field
|
||||||
func (c *Config) GetCreatePrivate() bool {
|
func (c *Config) GetCreatePrivateFlag() bool {
|
||||||
return c.CreateCmd.Private
|
return c.CreateCmd.PrivateFlag
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setter for createPrivate field
|
// Setter for createPrivate field
|
||||||
func (c *Config) SetCreatePrivate(value bool) {
|
func (c *Config) SetCreatePrivateFlag(value bool) {
|
||||||
c.CreateCmd.Private = value
|
c.CreateCmd.PrivateFlag = value
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -566,32 +642,56 @@ func (c *Config) InitCmdCreate(cmd *cobra.Command, args []string) {
|
|||||||
// validate flag on create command
|
// validate flag on create command
|
||||||
if cmd.Name() == "create" {
|
if cmd.Name() == "create" {
|
||||||
|
|
||||||
// set organization flag if set
|
|
||||||
if cmd.Flags().Changed("org") || cmd.Flags().Changed("o") {
|
|
||||||
c.SetListOrganization(cmd.Flag("org").Value.String())
|
|
||||||
c.SetListOrganizationFlag(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
// set name flag if set
|
// set name flag if set
|
||||||
if cmd.Flags().Changed("name") || cmd.Flags().Changed("n") {
|
if cmd.Flags().Changed("name") || cmd.Flags().Changed("n") {
|
||||||
c.SetCreateName(cmd.Flag("name").Value.String())
|
c.SetCreateName(cmd.Flag("name").Value.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// set description flag if set
|
// set description flag if set
|
||||||
if cmd.Flags().Changed("desc") || cmd.Flags().Changed("d") {
|
if cmd.Flags().Changed("description") || cmd.Flags().Changed("d") {
|
||||||
c.SetCreateDescription(cmd.Flag("desc").Value.String())
|
c.SetCreateDescription(cmd.Flag("description").Value.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// set private flag if set
|
// set Directory flag if set for create directories structure
|
||||||
if cmd.Flags().Changed("private") || cmd.Flags().Changed("p") {
|
if cmd.Flags().Changed("struc") || cmd.Flags().Changed("s") {
|
||||||
if cmd.Flag("private").Value.String() == "true" {
|
c.SetCreateDirectoryFlag(true)
|
||||||
c.SetCreatePrivate(true)
|
|
||||||
} else if cmd.Flag("private").Value.String() == "false" {
|
// set version flag if set for adding verion control
|
||||||
c.SetCreatePrivate(false)
|
if cmd.Flags().Changed("version") || cmd.Flags().Changed("v") {
|
||||||
} else {
|
c.SetCreateVersionFlag(true)
|
||||||
c.SetCreatePrivate(false)
|
}
|
||||||
|
|
||||||
|
// set Readme flag if set for adding readme file
|
||||||
|
if cmd.Flags().Changed("readme") || cmd.Flags().Changed("r") {
|
||||||
|
c.SetCreateReadmeFlag(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// if Git flag or Tea flag is set
|
||||||
|
if cmd.Flags().Changed("git") || cmd.Flags().Changed("g") || cmd.Flags().Changed("tea") || cmd.Flags().Changed("t") {
|
||||||
|
|
||||||
|
// set private flag if set
|
||||||
|
if cmd.Flags().Changed("private") || cmd.Flags().Changed("p") {
|
||||||
|
c.SetCreatePrivateFlag(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
// set organization flag if set
|
||||||
|
if cmd.Flags().Changed("org") || cmd.Flags().Changed("o") {
|
||||||
|
c.SetCreateOrgenization(cmd.Flag("org").Value.String())
|
||||||
|
c.SetCreateOrgenizationFlag(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
// set Git flag if set for creating git repository
|
||||||
|
if cmd.Flags().Changed("git") || cmd.Flags().Changed("g") {
|
||||||
|
c.SetCreateGitFlag(true)
|
||||||
|
|
||||||
|
} else if cmd.Flags().Changed("tea") || cmd.Flags().Changed("t") {
|
||||||
|
c.SetCreateTeaFlag(true)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -698,12 +798,17 @@ func (c *Config) printAllConfiguration() {
|
|||||||
|
|
||||||
fmt.Println("Create commands Configuration:")
|
fmt.Println("Create commands Configuration:")
|
||||||
fmt.Println("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
|
fmt.Println("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
|
||||||
fmt.Println("config: CreateName: ", c.GetCreateCmd().Name)
|
|
||||||
fmt.Println("config: Organization: ", c.GetCreateCmd().Organisation)
|
|
||||||
fmt.Println("config: CreateDescription: ", c.GetCreateCmd().Description)
|
|
||||||
fmt.Println("config: CreatePrivate: ", c.GetCreatePrivate())
|
|
||||||
fmt.Println("config: CreateCmd: ", c.GetCreateCmd())
|
fmt.Println("config: CreateCmd: ", c.GetCreateCmd())
|
||||||
|
fmt.Println("config: CreateName: ", c.GetCreateCmd().Name)
|
||||||
|
fmt.Println("config: CreateDescription: ", c.GetCreateDescription())
|
||||||
|
fmt.Println("config: CreateDirectory: ", c.GetCreateDirectoryFlag())
|
||||||
|
fmt.Println("config: VersionFlag", c.GetCreateVersionFlag())
|
||||||
|
fmt.Println("config: ReadMeFlag ", c.GetCreateReadmeFlag())
|
||||||
|
fmt.Println("config: GitFlag ", c.GetCreateGitFlag())
|
||||||
|
fmt.Println("config: TeaFlag ", c.GetCreateTeaFlag())
|
||||||
|
fmt.Println("config: Organization: ", c.GetCreateOrgenization())
|
||||||
|
fmt.Println("config: OrganizationFlag: ", c.GetCreateOrgenizationFlag())
|
||||||
|
fmt.Println("config: CreatePrivate: ", c.GetCreatePrivateFlag())
|
||||||
fmt.Println("Environment Variables Configuration:")
|
fmt.Println("Environment Variables Configuration:")
|
||||||
fmt.Println("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
|
fmt.Println("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
|
||||||
fmt.Println("config: EnvCmd: ", c.GetEnvCmd())
|
fmt.Println("config: EnvCmd: ", c.GetEnvCmd())
|
||||||
|
@ -12,10 +12,11 @@ type ConfigYml struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SectionConfig struct {
|
type SectionConfig struct {
|
||||||
Softwares map[string]SoftwareConfig `yaml:"software"`
|
Softwares map[string]SoftwareConfig `yaml:"software"`
|
||||||
EnvironmentsVariables map[string]string `yaml:"environments variables"`
|
EnvironmentsVariables map[string]string `yaml:"environments variables"`
|
||||||
Directory map[string]DirectoryConfig `yaml:"directory"`
|
Directory map[string]DirectoryConfig `yaml:"directory"`
|
||||||
Pipelines map[string]PipelineConfig `yaml:"pipelines"`
|
Pipelines map[string]PipelineConfig `yaml:"pipelines"`
|
||||||
|
InstallApps map[string]InstallAppsConfig `yaml:"install apps"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SoftwareConfig struct {
|
type SoftwareConfig struct {
|
||||||
@ -44,6 +45,12 @@ type PipelineConfig struct {
|
|||||||
Lint string `yaml:"lint"`
|
Lint string `yaml:"lint"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type InstallAppsConfig struct {
|
||||||
|
Name string `yaml:"name"`
|
||||||
|
CmdWin string `yaml:"cmdWin"`
|
||||||
|
CmdLinux string `yaml:"cmdLinux"`
|
||||||
|
}
|
||||||
|
|
||||||
// function GetPathsFromCategory
|
// function GetPathsFromCategory
|
||||||
func (c *ConfigYml) GetPathsFromCategory(sectionName string) ([]string, error) {
|
func (c *ConfigYml) GetPathsFromCategory(sectionName string) ([]string, error) {
|
||||||
section, ok := c.Sections[sectionName]
|
section, ok := c.Sections[sectionName]
|
||||||
|
@ -31,6 +31,7 @@ func init() {
|
|||||||
CfgGlobal.Init()
|
CfgGlobal.Init()
|
||||||
|
|
||||||
// root menu section
|
// root menu section
|
||||||
|
// - - - - - - - - - - -
|
||||||
rootCmd.Flags().BoolP("help", "h", false, "Show help for "+CfgGlobal.GetApplicationName())
|
rootCmd.Flags().BoolP("help", "h", false, "Show help for "+CfgGlobal.GetApplicationName())
|
||||||
rootCmd.Flags().BoolVarP(&CfgGlobal.VersionFlag, "version", "V", false, "Show VERSION of "+CfgGlobal.GetApplicationName())
|
rootCmd.Flags().BoolVarP(&CfgGlobal.VersionFlag, "version", "V", false, "Show VERSION of "+CfgGlobal.GetApplicationName())
|
||||||
rootCmd.CompletionOptions.DisableDefaultCmd = true
|
rootCmd.CompletionOptions.DisableDefaultCmd = true
|
||||||
@ -38,20 +39,31 @@ func init() {
|
|||||||
rootCmd.PersistentFlags().BoolVarP(&CfgGlobal.JsonFlag, "json", "j", false, "JSON output format")
|
rootCmd.PersistentFlags().BoolVarP(&CfgGlobal.JsonFlag, "json", "j", false, "JSON output format")
|
||||||
|
|
||||||
// List menu section
|
// List menu section
|
||||||
|
// - - - - - - - - - - -
|
||||||
cmdLists.ListCmd.Flags().StringVarP(&CfgGlobal.TokenEnv, "token", "t", "", "TOKEN for Gitea or Github")
|
cmdLists.ListCmd.Flags().StringVarP(&CfgGlobal.TokenEnv, "token", "t", "", "TOKEN for Gitea or Github")
|
||||||
cmdLists.ListCmd.Flags().BoolVarP(&CfgGlobal.ListCmd.GitFlag, "git", "g", false, "List all repositories from GITHUB")
|
cmdLists.ListCmd.Flags().BoolVarP(&CfgGlobal.ListCmd.GitFlag, "git", "g", false, "List all repositories from GITHUB")
|
||||||
cmdLists.ListCmd.Flags().BoolVarP(&CfgGlobal.ListCmd.TeaFlag, "tea", "a", false, "List all repositories from GITEA")
|
cmdLists.ListCmd.Flags().BoolVarP(&CfgGlobal.ListCmd.TeaFlag, "tea", "a", false, "List all repositories from GITEA")
|
||||||
cmdLists.ListCmd.Flags().StringVarP(&CfgGlobal.ListCmd.User, "user", "u", "", "user for request on GITHUB or GITEA")
|
cmdLists.ListCmd.Flags().StringVarP(&CfgGlobal.ListCmd.User, "user", "u", "", "user for request on GITHUB or GITEA")
|
||||||
cmdLists.ListCmd.Flags().StringVarP(&CfgGlobal.ListCmd.Organization, "org", "o", "", "List projects from an ORGANIZATION")
|
cmdLists.ListCmd.Flags().StringVarP(&CfgGlobal.ListCmd.Organization, "org", "o", "", "List projects from an ORGANIZATION")
|
||||||
|
|
||||||
// Create menu section
|
// Create menu section (create project directories structure, init git, Github or Gitea repository, create README.md template )
|
||||||
cmdCreate.CreateCmd.Flags().StringVarP(&CfgGlobal.TokenEnv, "token", "t", "", "TOKEN for Gitea or Github")
|
// - - - - - - - - - - - - - - - - - - -
|
||||||
cmdCreate.CreateCmd.Flags().StringVarP(&CfgGlobal.CreateCmd.Organisation, "org", "o", "", "ORGANIZATION for this project")
|
// project informations
|
||||||
cmdCreate.CreateCmd.Flags().StringVarP(&CfgGlobal.CreateCmd.Name, "name", "n", "", "NAME of the Project")
|
cmdCreate.CreateCmd.Flags().StringVarP(&CfgGlobal.CreateCmd.Name, "name", "n", "", "NAME of the Project")
|
||||||
cmdCreate.CreateCmd.Flags().StringVarP(&CfgGlobal.CreateCmd.Description, "desc", "d", "", "DESCRIPTION of the project")
|
cmdCreate.CreateCmd.Flags().StringVarP(&CfgGlobal.CreateCmd.Description, "desc", "d", "", "DESCRIPTION of the project")
|
||||||
cmdCreate.CreateCmd.Flags().BoolVarP(&CfgGlobal.CreateCmd.Private, "private", "p", false, "PRIVATE with this switch")
|
// project directories
|
||||||
|
cmdCreate.CreateCmd.Flags().BoolVarP(&CfgGlobal.CreateCmd.DirectoryFlag, "struc", "s", false, "Create project STRUCTURE")
|
||||||
|
// Project version
|
||||||
|
cmdCreate.CreateCmd.Flags().BoolVarP(&CfgGlobal.CreateCmd.VersionFlag, "Control", "c", false, "Add version CONTROL to the project")
|
||||||
|
// Project ReadMe
|
||||||
|
cmdCreate.CreateCmd.Flags().BoolVarP(&CfgGlobal.CreateCmd.ReadmeFlag, "readme", "r", false, "Add ReadMe.md to the project")
|
||||||
|
// Github or Gitea informations
|
||||||
|
cmdCreate.CreateCmd.Flags().StringVarP(&CfgGlobal.TokenEnv, "token", "t", "", "TOKEN for Gitea or Github")
|
||||||
|
cmdCreate.CreateCmd.Flags().StringVarP(&CfgGlobal.CreateCmd.Organization, "org", "o", "", "ORGANIZATION for this project")
|
||||||
|
cmdCreate.CreateCmd.Flags().BoolVarP(&CfgGlobal.CreateCmd.PrivateFlag, "private", "p", false, "PRIVATE with this switch")
|
||||||
|
|
||||||
// Env menu section
|
// Env menu section
|
||||||
|
// - - - - - - - - - - -
|
||||||
cmdEnv.EnvCmd.Flags().BoolVarP(&CfgGlobal.EnvCmd.EnvVariablesFlag, "group", "g", false, "GROUP environnement variables by categories")
|
cmdEnv.EnvCmd.Flags().BoolVarP(&CfgGlobal.EnvCmd.EnvVariablesFlag, "group", "g", false, "GROUP environnement variables by categories")
|
||||||
cmdEnv.EnvCmd.Flags().BoolVarP(&CfgGlobal.EnvCmd.EnvVariablesListFlag, "list", "l", false, "LIST environnement variables")
|
cmdEnv.EnvCmd.Flags().BoolVarP(&CfgGlobal.EnvCmd.EnvVariablesListFlag, "list", "l", false, "LIST environnement variables")
|
||||||
cmdEnv.EnvCmd.Flags().StringVarP(&CfgGlobal.EnvCmd.EnvVariablesFilter, "filter", "f", "", "HIGHLIGHT a specific word in environnement variables")
|
cmdEnv.EnvCmd.Flags().StringVarP(&CfgGlobal.EnvCmd.EnvVariablesFilter, "filter", "f", "", "HIGHLIGHT a specific word in environnement variables")
|
||||||
|
14
readme.md
14
readme.md
@ -1,18 +1,14 @@
|
|||||||
# Project Creator
|
# Project Creator
|
||||||
|
|
||||||
This is a simple CLI app to help you to do smalls things like :
|
Kode-Creator is a simple command-line interface (CLI) application designed to help developers get up and running quickly with some small tools for managing Github, software, environment variables, and more. The application is built using Go lang, which provides a simple, fast, and fun way to build your projects.
|
||||||
- Look organizations and projects on Github and Gitea.
|
|
||||||
- Create a startup project structure base on a configuration file
|
|
||||||
- Create and push your projects into Github or Gitea.
|
|
||||||
- Look and manange environnement variable
|
|
||||||
-
|
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
The **Kode-Creator** app allows you to:
|
The **Kode-Creator** app allows you to:
|
||||||
|
- Look organizations and projects on Github and Gitea.
|
||||||
- Create a Github project (repo)
|
- Create a startup project structure base on a configuration file
|
||||||
- Initialize a Git repository
|
- Create and push your projects into Github or Gitea.
|
||||||
|
- Look and manange environnement variable
|
||||||
- Create an initial commit
|
- Create an initial commit
|
||||||
- Generate a README.md file
|
- Generate a README.md file
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ type Version struct {
|
|||||||
|
|
||||||
// version variable that will be set at build time by versionManager.exe
|
// version variable that will be set at build time by versionManager.exe
|
||||||
// *** DO NOT EDIT ***
|
// *** DO NOT EDIT ***
|
||||||
var versionNumber Version = Version{0, 0, 0, 33}
|
var versionNumber Version = Version{0, 0, 0, 41}
|
||||||
|
|
||||||
// GetFullVersion returns the full version number as a string
|
// GetFullVersion returns the full version number as a string
|
||||||
func GetFullVersion() string {
|
func GetFullVersion() string {
|
||||||
|
Loading…
Reference in New Issue
Block a user