Set module to git.abrell.se/victor/mydev so it installs from the private Gitea host, and add an MIT LICENSE. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
47 lines
859 B
Go
47 lines
859 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"git.abrell.se/victor/mydev/internal/config"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var configCmd = &cobra.Command{
|
|
Use: "config",
|
|
Short: "Manage the config file",
|
|
}
|
|
|
|
var configPathCmd = &cobra.Command{
|
|
Use: "path",
|
|
Short: "Print the config file path",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
p, err := config.Path()
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
os.Exit(1)
|
|
}
|
|
fmt.Println(p)
|
|
},
|
|
}
|
|
|
|
var configInitCmd = &cobra.Command{
|
|
Use: "init",
|
|
Short: "Write a starter config file",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
p, err := config.Init()
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
os.Exit(1)
|
|
}
|
|
fmt.Printf("wrote %s — edit repos_roots to your paths\n", p)
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
configCmd.AddCommand(configPathCmd, configInitCmd)
|
|
rootCmd.AddCommand(configCmd)
|
|
}
|