1
0
Fork 0

Compare commits

...

4 Commits

6 changed files with 52 additions and 0 deletions

View File

@ -23,10 +23,16 @@ else
endif
install:
ifeq ($(shell go env GOOS),windows)
else
install -Dm 0755 bin/${EXEC_NAME} ${DESTDIR}${PREFIX}/bin/${EXEC_NAME}
endif
uninstall:
ifeq ($(shell go env GOOS),windows)
else
rm ${DESTDIR}${PREFIX}/bin/${EXEC_NAME}
endif
clean:
rm -f bin/*

View File

@ -72,6 +72,7 @@ func main() {
func version() {
fmt.Fprintf(os.Stderr, "mccl ver. %s\nCopyright (c) 2023 Alexander \"Arav\" Andreev <me@arav.su>\n", programVersion)
fmt.Fprintln(os.Stderr, "URL: https://git.arav.su/Arav/mccl")
fmt.Fprintln(os.Stderr, "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.")
}
@ -133,6 +134,39 @@ func parseArguments(args []string) (parsed arguments, err error) {
parsed.Uuid = "00000000-0000-0000-0000-000000000000"
for i := 0; i < len(args); i++ {
if args[i][0] != '-' {
if parsed.Command != "" {
return parsed, fmt.Errorf("there is already a command %s, but a second one (%s) was provided",
parsed.Command, args[i])
}
parsed.Command = args[i]
switch parsed.Command {
case "i":
fallthrough
case "install":
fallthrough
case "r":
fallthrough
case "run":
if i+3 > len(args) || args[i+1][0] == '-' {
return parsed, fmt.Errorf("a command %s is missing its version and directory arguments",
parsed.Command)
}
parsed.GameVersion = args[i+1]
parsed.Directory = args[i+2]
i += 2
case "l":
fallthrough
case "list":
if i+1 >= len(args) || args[i+1][0] == '-' {
return parsed, fmt.Errorf("a command list is missing its directory argument")
}
parsed.Directory = args[i+1]
i++
}
continue
}
switch args[i] {
case "-v":
fallthrough

View File

@ -1,3 +1,6 @@
//go:build unix
// +build unix
package util
func LocateJavaHome(component string, majorVersion int) (string, error) {

View File

@ -1,3 +1,6 @@
//go:build windows
// +build windows
package util
import (

View File

@ -1,3 +1,6 @@
//go:build unix
// +build unix
package util
import (

View File

@ -1,3 +1,6 @@
//go:build windows
// +build windows
package util
import (