diff --git a/examples/install-rustserver/main.go b/examples/install-rustserver/main.go index 1dbce9c..8d9423c 100644 --- a/examples/install-rustserver/main.go +++ b/examples/install-rustserver/main.go @@ -2,16 +2,25 @@ package main import ( "github.com/jensvandewiel/gosteamcmd" + "github.com/jensvandewiel/gosteamcmd/console" "os" ) func main() { //this code follows the steps of: https://www.rustafied.com/how-to-host-your-own-rust-server - cmd := gosteamcmd.New(os.Stdout) - cmd.Prompts = append(cmd.Prompts, gosteamcmd.ForceInstallDir("c:\\obamaserver\\")) - cmd.Prompts = append(cmd.Prompts, gosteamcmd.Login("", "")) - cmd.Prompts = append(cmd.Prompts, gosteamcmd.AppUpdate(258550, "", false)) - //running it headless means it will not output anything + + prompts := []*gosteamcmd.Prompt{ + gosteamcmd.ForceInstallDir("c:\\rustserver\\"), + gosteamcmd.Login("", ""), + gosteamcmd.AppUpdate(258550, "", true), + } + + cmd := gosteamcmd.New(os.Stdout, prompts) + + cmd.Console.Parser.OnInformationReceived = func(action console.Action, progress float64, currentWritten, total uint64) { + println("") + } + err := cmd.Run() if err != nil {