Skip to content

Commit

Permalink
Example updated to work with new code
Browse files Browse the repository at this point in the history
  • Loading branch information
JensvandeWiel committed Aug 3, 2023
1 parent c4258aa commit 5efe984
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions examples/install-rustserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5efe984

Please sign in to comment.