Default CLI config path to ~/.config/mcp/mcp.toml
Eliminates the need to pass --config on every command. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
@@ -18,7 +19,11 @@ func main() {
|
|||||||
Use: "mcp",
|
Use: "mcp",
|
||||||
Short: "Metacircular Control Plane CLI",
|
Short: "Metacircular Control Plane CLI",
|
||||||
}
|
}
|
||||||
root.PersistentFlags().StringVarP(&cfgPath, "config", "c", "", "config file path")
|
defaultCfg := ""
|
||||||
|
if home, err := os.UserHomeDir(); err == nil {
|
||||||
|
defaultCfg = filepath.Join(home, ".config", "mcp", "mcp.toml")
|
||||||
|
}
|
||||||
|
root.PersistentFlags().StringVarP(&cfgPath, "config", "c", defaultCfg, "config file path")
|
||||||
|
|
||||||
root.AddCommand(&cobra.Command{
|
root.AddCommand(&cobra.Command{
|
||||||
Use: "version",
|
Use: "version",
|
||||||
|
|||||||
Reference in New Issue
Block a user