(state *globalState)
| 38 | } |
| 39 | |
| 40 | func (a *App) configListCommand(state *globalState) *cobra.Command { |
| 41 | return &cobra.Command{ |
| 42 | Use: "list", |
| 43 | Short: "List configuration files", |
| 44 | Args: cobra.NoArgs, |
| 45 | RunE: func(cmd *cobra.Command, args []string) error { |
| 46 | out := cmd.OutOrStdout() |
| 47 | fmt.Fprintln(out, "CAM configuration:") |
| 48 | for _, p := range []string{ |
| 49 | filepath.Join(pathutil.ConfigDir(), "cam.db"), |
| 50 | filepath.Join(pathutil.ConfigDir(), "config.yaml"), |
| 51 | filepath.Join(pathutil.Home(), ".env"), |
| 52 | } { |
| 53 | marker := " " |
| 54 | if pathutil.Exists(p) { |
| 55 | marker = "✓" |
| 56 | } |
| 57 | fmt.Fprintf(out, " %s %s\n", marker, p) |
| 58 | } |
| 59 | fmt.Fprintln(out, "\nEditor configurations:") |
| 60 | registry := editorconfig.DefaultRegistry() |
| 61 | for _, name := range registry.Names() { |
| 62 | tool, _ := registry.Get(name) |
| 63 | fmt.Fprintf(out, "\n %s (%s):\n", tool.Description(), tool.Name()) |
| 64 | for _, p := range tool.UserPaths() { |
| 65 | marker := " " |
| 66 | if pathutil.Exists(p) { |
| 67 | marker = "✓" |
| 68 | } |
| 69 | fmt.Fprintf(out, " %s %s\n", marker, p) |
| 70 | } |
| 71 | if pp := tool.ProjectPath(); pp != "" { |
| 72 | marker := " " |
| 73 | if pathutil.Exists(pp) { |
| 74 | marker = "✓" |
| 75 | } |
| 76 | fmt.Fprintf(out, " %s %s\n", marker, pp) |
| 77 | } |
| 78 | } |
| 79 | return nil |
| 80 | }, |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | func (a *App) configValidateCommand(state *globalState) *cobra.Command { |
| 85 | return &cobra.Command{ |
no test coverage detected