From 8c1332020d25f74baa463bb1cec0e6783f565034 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 6 May 2024 17:30:43 +0200 Subject: feat: link to exact commits in NixOS/nixpkgs --- process/main.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'process') diff --git a/process/main.go b/process/main.go index 3c9b67a..1089144 100644 --- a/process/main.go +++ b/process/main.go @@ -4,6 +4,8 @@ import ( "log" "log/slog" "os" + "strings" + "searchix/internal/options" "github.com/ardanlabs/conf/v3" @@ -11,8 +13,11 @@ import ( ) type Config struct { - Input string `conf:"short:i,required,help:NixOS options file (json)"` - Output string `conf:"short:o,default:/dev/stdout"` + 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() { @@ -29,8 +34,15 @@ func main() { } 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) + err = options.Process(config.Input, config.Output, config.Channel, config.Revision) if err != nil { log.Fatalf("Error processing file: %v", err) } -- cgit 1.4.1