1
0

完成一个简易的全局skill、command管理器

This commit is contained in:
2026-02-25 14:33:56 +08:00
parent f4cb809f9d
commit 2d327b5af8
60 changed files with 6053 additions and 1 deletions

View File

@@ -0,0 +1,44 @@
package main
import (
"fmt"
"github.com/spf13/cobra"
"skillmgr/internal/config"
)
var listReposCmd = &cobra.Command{
Use: "list-repos",
Short: "列出已配置的源仓库",
Long: `显示所有已添加的源仓库及其信息。
示例:
skillmgr list-repos`,
RunE: func(cmd *cobra.Command, args []string) error {
cfg, err := config.LoadRepositoryConfig()
if err != nil {
return err
}
if len(cfg.Repositories) == 0 {
fmt.Println("无已配置的源仓库")
fmt.Println("\n使用 'skillmgr add <url>' 添加仓库")
return nil
}
fmt.Println("已配置的源仓库:")
for _, repo := range cfg.Repositories {
fmt.Printf("\n %s\n", repo.Name)
fmt.Printf(" URL: %s\n", repo.URL)
fmt.Printf(" 分支: %s\n", repo.Branch)
fmt.Printf(" 添加于: %s\n", repo.AddedAt.Format("2006-01-02 15:04:05"))
}
return nil
},
}
func init() {
rootCmd.AddCommand(listReposCmd)
}