remove script flag

This commit is contained in:
filifa 2024-09-04 20:28:42 -05:00
parent 663accda2a
commit 3981512edb
1 changed files with 0 additions and 29 deletions

View File

@ -17,7 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd package cmd
import ( import (
"encoding/json"
"log" "log"
"os" "os"
@ -26,32 +25,8 @@ import (
) )
var presets []string var presets []string
var scriptPath string
var transition bool var transition bool
type script []string
func (s *script) load(path string) error {
f, err := os.Open(path)
if err != nil {
return err
}
defer f.Close()
err = json.NewDecoder(f).Decode(s)
return err
}
func getPresets() []string {
if scriptPath != "" {
var s script
s.load(scriptPath)
presets = s
}
return presets
}
func handleWindowEvent(event *sdl.WindowEvent, m *milkDropWindow) { func handleWindowEvent(event *sdl.WindowEvent, m *milkDropWindow) {
switch event.Event { switch event.Event {
case sdl.WINDOWEVENT_RESIZED: case sdl.WINDOWEVENT_RESIZED:
@ -98,7 +73,6 @@ func milkbucket(cmd *cobra.Command, args []string) {
} }
defer sdl.Quit() defer sdl.Quit()
presets := getPresets()
for _, p := range presets { for _, p := range presets {
info, err := os.Stat(p) info, err := os.Stat(p)
if err != nil { if err != nil {
@ -165,7 +139,4 @@ func init() {
rootCmd.Flags().BoolVarP(&transition, "transition", "t", false, "smoothly transition between presets") rootCmd.Flags().BoolVarP(&transition, "transition", "t", false, "smoothly transition between presets")
rootCmd.Flags().StringArrayVarP(&presets, "presets", "p", []string{}, "preset files to use") rootCmd.Flags().StringArrayVarP(&presets, "presets", "p", []string{}, "preset files to use")
rootCmd.Flags().StringVarP(&scriptPath, "script", "s", "", "script file to use")
rootCmd.MarkFlagsMutuallyExclusive("presets", "script")
} }