From 28bdb894410bff18cf9e81a8db42f8132bde9379 Mon Sep 17 00:00:00 2001 From: Jens van de Wiel Date: Thu, 3 Aug 2023 23:52:25 +0200 Subject: [PATCH] removed headless, just use io.Discard --- steamcmd.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/steamcmd.go b/steamcmd.go index ab31494..df2ae55 100644 --- a/steamcmd.go +++ b/steamcmd.go @@ -10,16 +10,19 @@ type SteamCMD struct { Prompts []*Prompt console *console.Console - stdout io.Writer + Stdout io.Writer } -func New() *SteamCMD { +// New creates a new SteamCMD instance. +func New(stdout io.Writer) *SteamCMD { return &SteamCMD{ Prompts: make([]*Prompt, 0), + Stdout: stdout, } } -func (s *SteamCMD) RunHeadless() error { +// Run puts all the prompts together and executes them. +func (s *SteamCMD) Run() error { cmd := "steamcmd" for _, prompt := range s.Prompts { @@ -27,8 +30,7 @@ func (s *SteamCMD) RunHeadless() error { } cmd += " +quit" - - s.console = console.New(cmd, s.stdout) + s.console = console.New(cmd, s.Stdout) err := s.console.Run() if err != nil { return err