Add short subcommand aliases and EN/RU CLI localization

Subcommands gain one/two-letter aliases (dl, i, e, v, h) alongside
their full names. CLI-owned chrome - top-level usage, per-subcommand
usage lines, progress messages, and the license prompt - now goes
through internal/i18n, an env-driven message catalog (MSVC_GO_WINE_LANG,
falling back to the standard LC_ALL/LC_MESSAGES/LANG locale variables)
with English and Russian translations. Deeper error text from internal
packages stays in English.

Also refreshed the top-level usage text, which hadn't kept up with
--with-wdk/--list-workloads/--list-components/--print-deps-tree.
This commit is contained in:
Cheviiot
2026-07-25 03:31:59 +10:00
parent 8551d7fe99
commit 23ea620ce2
5 changed files with 206 additions and 38 deletions
+8 -20
View File
@@ -12,6 +12,7 @@ import (
"path/filepath"
"strings"
"github.com/Cheviiot/msvc-go-wine/internal/i18n"
"github.com/Cheviiot/msvc-go-wine/internal/wrapper"
)
@@ -40,38 +41,25 @@ func runCLI(args []string) int {
}
switch args[0] {
case "download":
case "download", "dl":
return runDownload(args[1:])
case "install":
case "install", "i":
return runInstall(args[1:])
case "env":
case "env", "e":
return runEnv(args[1:])
case "version":
case "version", "v", "--version":
fmt.Println("msvc-go-wine " + version)
return 0
case "-h", "--help", "help":
case "-h", "--help", "help", "h":
printUsage()
return 0
default:
fmt.Fprintf(os.Stderr, "msvc-go-wine: unknown subcommand %q\n\n", args[0])
fmt.Fprint(os.Stderr, i18n.T("main.unknown_subcommand", args[0]))
printUsage()
return 1
}
}
func printUsage() {
fmt.Fprint(os.Stderr, `msvc-go-wine - cross compile with MSVC on Linux via Wine
Usage:
msvc-go-wine download --accept-license [--dest <dir>] [options]
fetch and unpack MSVC/WinSDK
msvc-go-wine install [dir] wire up wrappers for a downloaded MSVC
msvc-go-wine env --bin <dir/bin/arch> print INCLUDE/LIB for native clang-cl/lld-link use
msvc-go-wine version print the version
--dest/[dir] default to ~/.msvc-go-wine if omitted.
Once installed, add <dir>/bin/<arch> to PATH and invoke the tools directly:
cl, link, lib, ml, ml64, mc, midl, mt, rc, dumpbin, msbuild, nmake, armasm, armasm64, cmd, findstr
`)
fmt.Fprint(os.Stderr, i18n.T("main.usage"))
}