Files
Vintner/cmd/msvc-go-wine/install.go
T
Cheviiot 8f52e5861a Default download/install to ~/.msvc-go-wine when no dir is given
--dest (download) and the positional dir (install) were previously
required, forcing every user to pick and remember a location. Both now
default to a single hidden ~/.msvc-go-wine, matching the convention most
CLI tools use for their own data dir - still overridable for anyone who
wants a different location.
2026-07-25 01:38:47 +10:00

42 lines
921 B
Go

package main
import (
"fmt"
"os"
"github.com/Cheviiot/msvc-go-wine/internal/install"
)
func runInstall(args []string) int {
if len(args) > 1 || (len(args) == 1 && (args[0] == "-h" || args[0] == "--help")) {
fmt.Fprintln(os.Stderr, "usage: msvc-go-wine install [dest] (default: ~/.msvc-go-wine)")
return 1
}
var dest string
if len(args) == 1 {
dest = args[0]
} else {
def, err := defaultToolchainDir()
if err != nil {
fmt.Fprintln(os.Stderr, "msvc-go-wine install:", err)
return 1
}
dest = def
fmt.Println("No directory given, using default:", dest)
}
self, err := os.Executable()
if err != nil {
fmt.Fprintln(os.Stderr, "msvc-go-wine install:", err)
return 1
}
if err := install.Install(dest, self); err != nil {
fmt.Fprintln(os.Stderr, "msvc-go-wine install:", err)
return 1
}
fmt.Println("Done. Add", dest+"/bin/<arch> to PATH to use cl, link, lib, ...")
return 0
}