miller/cmd/experiments/cli_parser/arch/args_windows.go
2022-01-23 23:22:55 -05:00

26 lines
440 B
Go

// +build windows
package arch
import (
"fmt"
"os"
shellquote "github.com/kballard/go-shellquote"
"golang.org/x/sys/windows"
)
func GetMainArgs() []string {
commandLine := windows.UTF16PtrToString(windows.GetCommandLine())
split, err := shellquote.Split(commandLine)
if err != nil {
fmt.Fprintf(
os.Stderr,
"%s: could not parse obtain Windows command line: %v\n",
os.Args[0], err,
)
os.Exit(1)
}
return split
}