@@ -14,9 +14,9 @@ import (
1414)
1515
1616// InstallTools installs all tools defined in the configuration
17- func InstallTools () error {
18- for name , toolInfo := range Config .Tools () {
19- err := InstallTool (name , toolInfo )
17+ func InstallTools (config * ConfigType , registry string ) error {
18+ for name , toolInfo := range config .Tools () {
19+ err := InstallTool (name , toolInfo , registry )
2020 if err != nil {
2121 return fmt .Errorf ("failed to install tool %s: %w" , name , err )
2222 }
@@ -25,7 +25,7 @@ func InstallTools() error {
2525}
2626
2727// InstallTool installs a specific tool
28- func InstallTool (name string , toolInfo * plugins.ToolInfo ) error {
28+ func InstallTool (name string , toolInfo * plugins.ToolInfo , registry string ) error {
2929 // Check if the tool is already installed
3030 if isToolInstalled (toolInfo ) {
3131 fmt .Printf ("Tool %s v%s is already installed\n " , name , toolInfo .Version )
@@ -50,10 +50,10 @@ func InstallTool(name string, toolInfo *plugins.ToolInfo) error {
5050 }
5151
5252 // Handle other runtime-based tools
53- return installRuntimeTool (name , toolInfo )
53+ return installRuntimeTool (name , toolInfo , registry )
5454}
5555
56- func installRuntimeTool (name string , toolInfo * plugins.ToolInfo ) error {
56+ func installRuntimeTool (name string , toolInfo * plugins.ToolInfo , registry string ) error {
5757 // Get the runtime for this tool
5858 runtimeInfo , ok := Config .Runtimes ()[toolInfo .Runtime ]
5959 if ! ok {
@@ -65,7 +65,7 @@ func installRuntimeTool(name string, toolInfo *plugins.ToolInfo) error {
6565 "InstallDir" : toolInfo .InstallDir ,
6666 "PackageName" : toolInfo .Name ,
6767 "Version" : toolInfo .Version ,
68- "Registry" : "" , // TODO: Get registry from config
68+ "Registry" : registry ,
6969 }
7070
7171 // Get package manager binary based on the tool configuration
@@ -76,12 +76,14 @@ func installRuntimeTool(name string, toolInfo *plugins.ToolInfo) error {
7676 }
7777
7878 // Set registry if provided
79- if toolInfo . RegistryCommand != "" {
79+ if registry != "" {
8080 regCmd , err := executeToolTemplate (toolInfo .RegistryCommand , templateData )
8181 if err != nil {
8282 return fmt .Errorf ("failed to prepare registry command: %w" , err )
8383 }
8484
85+ log .Printf ("Setting registry...\n %s %s\n " , packageManagerBinary , regCmd )
86+
8587 if regCmd != "" {
8688 registryCmd := exec .Command (packageManagerBinary , strings .Split (regCmd , " " )... )
8789 if output , err := registryCmd .CombinedOutput (); err != nil {
0 commit comments