strip-beats/app/run.go
2023-09-06 18:46:09 -05:00

46 lines
652 B
Go

package app
import (
"fmt"
"os"
"codeberg.org/danjones000/strip-beats/input/boolean"
"codeberg.org/danjones000/strip-beats/media"
)
type AppStep int
const (
Pick AppStep = iota
Watch
Restart
Quit
)
func quit() {
PickAgain()
fmt.Println("Goodbye!")
os.Exit(0)
}
func Run(step AppStep) {
for step < Quit {
switch step {
case Pick:
PickAgain()
PickFileWithConf()
if file == nil {
quit()
}
watch := boolean.Choose(fmt.Sprintf("Would you like to watch %s?", file.ShortPath()))
if watch {
step = Watch
}
case Watch:
media.Watch(file.Format.Path)
step = Quit // @todo
case Quit:
quit()
}
}
}