add server configuration
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s

This commit is contained in:
Thomas Peetz
2026-10-08 17:40:17 +02:00
parent 7116869b42
commit ffa4786113
11 changed files with 292 additions and 97 deletions
+11 -14
View File
@@ -2,30 +2,25 @@ package cmd
import (
"fmt"
"kontor-api-gin/internal/config"
"log/slog"
"os"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var cfgFile string
var verbose int
// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "kontor-cli",
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. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Use: "kontor-cli",
TraverseChildren: true,
Short: "A brief description of your application",
Long: ``,
// Uncomment the following line if your bare application
// has an action associated with it:
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
slog.Info("Verbosity level", "level", verbose)
slog.Info("Verbosity level", "level", config.Verbose)
},
}
@@ -37,6 +32,8 @@ func Execute() {
}
func init() {
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "c", "config file (default is $HOME/.config/kli.yaml)")
rootCmd.PersistentFlags().CountVarP(&verbose, "verbose", "v", "increase verbosity (-v, -vv, -vvv)")
rootCmd.PersistentFlags().StringVarP(&config.CfgFile, "config", "c", "/home/tpeetz/.config/kli.yaml", "config file")
rootCmd.PersistentFlags().CountVarP(&config.Verbose, "verbose", "v", "increase verbosity (-v, -vv, -vvv)")
viper.BindPFlag("config", rootCmd.PersistentFlags().Lookup("config"))
cobra.OnInitialize(config.InitCliConfig)
}