Always use a profile file.
This commit is contained in:
parent
e23db23eae
commit
8662153706
@ -36,23 +36,21 @@ func (rc *RunCommand) Run() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if rc.UseProfile {
|
||||
if util.IsFileExist(path.Join(rc.GameDir, mcclprofile.ProfileFileName)) {
|
||||
p, err := mcclprofile.Load(rc.GameDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rc.Username = p.Username
|
||||
rc.AuthUuid = p.Uuid
|
||||
rc.JavaXmx = p.JavaXmx
|
||||
} else {
|
||||
p := mcclprofile.Profile{
|
||||
Username: rc.Username,
|
||||
Uuid: rc.AuthUuid,
|
||||
JavaXmx: rc.JavaXmx}
|
||||
if err := p.Store(rc.GameDir); err != nil {
|
||||
return err
|
||||
}
|
||||
if util.IsFileExist(path.Join(rc.GameDir, mcclprofile.ProfileFileName)) {
|
||||
p, err := mcclprofile.Load(rc.GameDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rc.Username = p.Username
|
||||
rc.AuthUuid = p.Uuid
|
||||
rc.JavaXmx = p.JavaXmx
|
||||
} else {
|
||||
p := mcclprofile.Profile{
|
||||
Username: rc.Username,
|
||||
Uuid: rc.AuthUuid,
|
||||
JavaXmx: rc.JavaXmx}
|
||||
if err := p.Store(rc.GameDir); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"mccl/cmd/mccl/commands"
|
||||
mcclprofile "mccl/internal/mccl_profile"
|
||||
"os"
|
||||
)
|
||||
|
||||
@ -98,11 +97,7 @@ func usage() {
|
||||
" -U,--uuid UUID\n"+
|
||||
" player's account UUID (all zeroes by default)\n"+
|
||||
" --java-Xmx memory\n"+
|
||||
" java's -Xmx param, e.g. 4G\n"+
|
||||
" --profile\n"+
|
||||
" load/save username, UUID, and -Xmx from/to a file.\n"+
|
||||
" Once saved, you can ommit -u,-U and --java-Xmx,\n"+
|
||||
" since they will be stored in", mcclprofile.ProfileFileName)
|
||||
" java's -Xmx param, e.g. 4G")
|
||||
}
|
||||
|
||||
type arguments struct {
|
||||
@ -203,8 +198,6 @@ func parseArguments(args []string) (parsed arguments, err error) {
|
||||
}
|
||||
parsed.JavaXmx = args[i+1]
|
||||
i++
|
||||
case "--profile":
|
||||
parsed.UseProfile = true
|
||||
default:
|
||||
err = fmt.Errorf("an unknown option %s was provided", args[i])
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user