RunConfig dispatches the "config" subcommand.
(subCmd, root string)
| 35 | |
| 36 | // RunConfig dispatches the "config" subcommand. |
| 37 | func RunConfig(subCmd, root string) { |
| 38 | absRoot, err := filepath.Abs(root) |
| 39 | if err != nil { |
| 40 | fmt.Fprintf(os.Stderr, "Error: %v\n", err) |
| 41 | os.Exit(1) |
| 42 | } |
| 43 | |
| 44 | switch subCmd { |
| 45 | case "init": |
| 46 | configInit(absRoot) |
| 47 | case "show": |
| 48 | configShow(absRoot) |
| 49 | default: |
| 50 | fmt.Fprintln(os.Stderr, "Usage: codemap config <init|show> [path]") |
| 51 | fmt.Fprintln(os.Stderr) |
| 52 | fmt.Fprintln(os.Stderr, " init Create .codemap/config.json with auto-detected extensions") |
| 53 | fmt.Fprintln(os.Stderr, " show Display current project config") |
| 54 | os.Exit(1) |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | func configInit(root string) { |
| 59 | result, err := initProjectConfig(root) |