about summary refs log tree commit diff stats
path: root/process/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'process/main.go')
-rw-r--r--process/main.go49
1 files changed, 0 insertions, 49 deletions
diff --git a/process/main.go b/process/main.go
deleted file mode 100644
index 1089144..0000000
--- a/process/main.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package main
-
-import (
-	"log"
-	"log/slog"
-	"os"
-	"strings"
-
-	"searchix/internal/options"
-
-	"github.com/ardanlabs/conf/v3"
-	"github.com/pkg/errors"
-)
-
-type Config struct {
-	Input        string `conf:"short:i,required,help:NixOS options file (json)"`
-	Output       string `conf:"short:o,default:/dev/stdout"`
-	Revision     string `conf:"short:r,flag:revision,default:master"`
-	RevisionFile string `conf:"short:f,flag:revision-file"`
-	Channel      string `conf:"short:c,flag:channel,default:nixpkgs"`
-}
-
-func main() {
-	if os.Getenv("DEBUG") != "" {
-		slog.SetLogLoggerLevel(slog.LevelDebug)
-	}
-	log.SetFlags(0)
-
-	config := Config{}
-	help, err := conf.Parse("", &config)
-	if err != nil {
-		if errors.Is(err, conf.ErrHelpWanted) {
-			log.Fatalln(help)
-		}
-		log.Fatalf("parsing command line: %v", err)
-	}
-	if config.RevisionFile != "" {
-		f, err := os.ReadFile(config.RevisionFile)
-		if err != nil {
-			log.Fatalf("Error reading revision file %s: %v", config.RevisionFile, err)
-		}
-		config.Revision = strings.TrimSpace(string(f))
-	}
-
-	err = options.Process(config.Input, config.Output, config.Channel, config.Revision)
-	if err != nil {
-		log.Fatalf("Error processing file: %v", err)
-	}
-}