Browse Source

Add command line flag to allow only running the config ui

master
KemoNine 2 years ago
parent
commit
ce9f53cb45
  1. 21
      cmd/gui/gui.go

21
cmd/gui/gui.go

@ -11,7 +11,12 @@ import (
"github.com/knadh/koanf/providers/file"
"github.com/knadh/koanf/providers/posflag"
flag "github.com/spf13/pflag"
//"git.kemonine.info/PiFrame/ui"
"git.kemonine.info/PiFrame/ui"
)
const (
CLI_FLAG_CONFIG_ONLY = "config-ui-only"
)
const (
@ -33,13 +38,18 @@ const (
func main() {
// Command line flag handler
f := flag.NewFlagSet("config", flag.ContinueOnError)
f := flag.NewFlagSet("piframe", flag.ContinueOnError)
f.Usage = func() {
fmt.Println(f.FlagUsages())
os.Exit(0)
}
// Command line flags
f.Bool("config-ui-only", false, "Only show the config UI, NOT the slideshow")
f.Bool(CLI_FLAG_CONFIG_ONLY, false, "Only show the config UI, NOT the slideshow")
cliFlag := f.Lookup(CLI_FLAG_CONFIG_ONLY)
if cliFlag != nil {
log.Print("Could not find CLI_FLAG_CONFIG_ONLY")
cliFlag.NoOptDefVal = "true"
}
// Process command line flags into handler
f.Parse(os.Args[1:])
@ -78,6 +88,9 @@ func main() {
// albumsRoot := pfConfig.String(CONFIG_KEY_ALBUMS_ROOT)
// albumsSelected := pfConfig.Strings(CONFIG_KEY_ALBUMS_SELECTED)
//ui.Slideshow()
if !pfConfig.Bool(CLI_FLAG_CONFIG_ONLY) {
ui.Slideshow()
}
//ui.ConfigGui()
}

Loading…
Cancel
Save