allow passing in multiple presets
This commit is contained in:
parent
2b8eaeee49
commit
663accda2a
12
cmd/root.go
12
cmd/root.go
|
@ -25,7 +25,7 @@ import (
|
||||||
"github.com/veandco/go-sdl2/sdl"
|
"github.com/veandco/go-sdl2/sdl"
|
||||||
)
|
)
|
||||||
|
|
||||||
var preset string
|
var presets []string
|
||||||
var scriptPath string
|
var scriptPath string
|
||||||
var transition bool
|
var transition bool
|
||||||
|
|
||||||
|
@ -43,12 +43,6 @@ func (s *script) load(path string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPresets() []string {
|
func getPresets() []string {
|
||||||
var presets []string
|
|
||||||
|
|
||||||
if preset != "" {
|
|
||||||
presets = []string{preset}
|
|
||||||
}
|
|
||||||
|
|
||||||
if scriptPath != "" {
|
if scriptPath != "" {
|
||||||
var s script
|
var s script
|
||||||
s.load(scriptPath)
|
s.load(scriptPath)
|
||||||
|
@ -170,8 +164,8 @@ func init() {
|
||||||
// when this action is called directly.
|
// when this action is called directly.
|
||||||
rootCmd.Flags().BoolVarP(&transition, "transition", "t", false, "smoothly transition between presets")
|
rootCmd.Flags().BoolVarP(&transition, "transition", "t", false, "smoothly transition between presets")
|
||||||
|
|
||||||
rootCmd.Flags().StringVarP(&preset, "preset", "p", "", "preset file to use")
|
rootCmd.Flags().StringArrayVarP(&presets, "presets", "p", []string{}, "preset files to use")
|
||||||
rootCmd.Flags().StringVarP(&scriptPath, "script", "s", "", "script file to use")
|
rootCmd.Flags().StringVarP(&scriptPath, "script", "s", "", "script file to use")
|
||||||
|
|
||||||
rootCmd.MarkFlagsMutuallyExclusive("preset", "script")
|
rootCmd.MarkFlagsMutuallyExclusive("presets", "script")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue