-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprompt.go
47 lines (39 loc) · 1.09 KB
/
prompt.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package gosteamcmd
import "strconv"
type PromptType int
const (
AppUpdatePrompt PromptType = iota
LoginPrompt
ForceInstallDirPrompt
)
type Prompt struct {
FullPrompt string
Type PromptType
}
// AppUpdate updates the given appID. If beta is not empty, it will update to the given beta. If validate is true, it will validate the files.
func AppUpdate(appID int, beta string, validate bool) *Prompt {
cmd := "app_update "
cmd += strconv.Itoa(appID) + " "
if beta != "" {
cmd += "-beta " + beta + " "
}
if validate {
cmd += "validate"
}
return &Prompt{cmd, AppUpdatePrompt}
}
// Login logs into SteamCMD with the given username and password. If the arguments are empty strings, it will login as anonymous.
func Login(username string, password string, authcode string) *Prompt {
cmd := "login "
if username != "" {
cmd += username + " " + password + " " + authcode + " "
} else {
cmd += "anonymous"
}
return &Prompt{cmd, LoginPrompt}
}
func ForceInstallDir(directory string) *Prompt {
cmd := "force_install_dir "
cmd += directory
return &Prompt{cmd, ForceInstallDirPrompt}
}