mydev/cmd/config.go
Victor Abrell 47bb2d3a69 Use Gitea module path, add MIT license
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>
2026-06-12 14:41:20 +02:00

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)
}