Initial setup

main
Drew Bednar 6 days ago
parent e963343942
commit dae59eda95

@ -0,0 +1,5 @@
# This file tells Gitea to process variable substitution in the following files.
go.mod
README.md
cmd/${REPO_NAME}/main.go

@ -1,2 +1,18 @@
# go-cli-template # ${REPO_NAME}
A new Go CLI application.
## Description
${REPO_DESCRIPTION}
## Getting Started
### Prerequisites
* Go (version 1.24 or later)
### Installation
```sh
go install [github.com/<span class="math-inline">\]\(https\://github\.com/</span>){REPO_OWNER}/${REPO_NAME}@latest

@ -0,0 +1,28 @@
package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "${REPO_NAME}",
Short: "A brief description of your application",
Long: `A longer description that spans multiple lines and likely contains
examples and usage of using your application.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Hello from your new Go CLI!")
},
}
// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() error {
return rootCmd.Execute()
}
func init() {
// Here you will define your flags and configuration settings.
}

@ -0,0 +1,7 @@
module git.runcible.com/${REPO_OWNER}/${REPO_NAME}
go 1.24
require (
github.com/spf13/cobra v1.9.1
)

@ -0,0 +1,13 @@
package main
import (
"log"
"github.com/${REPO_OWNER}/${REPO_NAME}/cmd"
)
func main() {
if err := cmd.Execute(); err != nil {
log.Fatalf("error executing command: %v", err)
}
}
Loading…
Cancel
Save