package sendoverhttp import ( "fmt" "os" "github.com/mdp/qrterminal/v3" _ "github.com/mdp/qrterminal/v3" ) type TerminalQRShower struct { waiter *Waiter str string } func NewTerminalQRShower(str string) *TerminalQRShower { return &TerminalQRShower{ waiter: NewWaiter(), str: str, } } // Start the run, returning any error which occurs from start to // finish. func (s *TerminalQRShower) Start() error { qrterminal.Generate(s.str, qrterminal.L, os.Stdout) fmt.Println() fmt.Printf("Hosting file at %s", s.str) fmt.Println() fmt.Println() s.waiter.Wait() return nil } // Stop the run and wait until it has ended. It can be called multiple // times, ending immediately. func (s *TerminalQRShower) Stop() { s.waiter.Stop() }