From 5efe9840b8b6f6855493a8ce3299b368eb532c01 Mon Sep 17 00:00:00 2001 From: Jens van de Wiel Date: Fri, 4 Aug 2023 01:07:15 +0200 Subject: [PATCH] Example updated to work with new code --- examples/install-rustserver/main.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) 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 {