mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 21:36:40 -10:00
tools.Env holds what the shared tools run with (folders, assets, host,
HTTP client, UI hooks) and what the groups share: the platforms, devvm's
mise.toml, a tool's image file and the share's lock. Versions, Share and
VMs each embed it:
- Versions: the tools lock, resolving it with the host's mise, the daily
check and refresh, the image files of an image name's tools.
- Share: building, listing and deleting the share's tool images.
- VMs: newer tools than a VM's, and moving a VM to them.
vm.Env and build.Builder hold a *tools.Env; callers name the group they
use (tools.Versions{Env: e.Tools}.Files, tools.Share{Env: b.Tools}.List).
internal/tools.Tools leaves the structure test's largeTypes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
32 lines
903 B
Go
32 lines
903 B
Go
package cli
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/w3cj/devvm/assets"
|
|
"github.com/w3cj/devvm/internal/msg"
|
|
"github.com/w3cj/devvm/internal/paths"
|
|
"github.com/w3cj/devvm/internal/tools"
|
|
"github.com/w3cj/devvm/internal/ui"
|
|
)
|
|
|
|
// newRefreshToolsCmd is devvm _refresh-tools: the daily check for newer
|
|
// shared tools, which devvm starts in the background (tools.RefreshDaily).
|
|
// Hidden: it's not for users.
|
|
func newRefreshToolsCmd(u *ui.UI) *cobra.Command {
|
|
return &cobra.Command{
|
|
Use: "_refresh-tools",
|
|
Short: "Resolve the shared tools' versions again",
|
|
Hidden: true,
|
|
Args: cobra.NoArgs,
|
|
RunE: func(cmd *cobra.Command, _ []string) error {
|
|
dirs, err := paths.FromEnv()
|
|
if err == nil {
|
|
err = tools.Versions{Env: tools.New(dirs, assets.FS, u)}.Refresh(cmd.Context())
|
|
}
|
|
fail(u, err, func(string) msg.M { return msg.ToolsCheckFailed() })
|
|
return nil
|
|
},
|
|
}
|
|
}
|