this repo has no description

add cli

Alex Ottr eb483bcb e20d51d5

+62 -1
+2 -1
.gitignore
··· 45 45 nox 46 46 keys 47 47 secrets 48 - .nox-state.json 48 + .nox-state.json 49 + !cmd/nox
+60
cmd/nox/main.go
··· 1 + package main 2 + 3 + import ( 4 + "log" 5 + "os" 6 + "context" 7 + 8 + "github.com/aottr/nox/internal/config" 9 + "github.com/aottr/nox/internal/constants" 10 + "github.com/aottr/nox/internal/process" 11 + "github.com/urfave/cli/v3" 12 + ) 13 + 14 + func main() { 15 + 16 + var configPath string 17 + 18 + cmd := &cli.Command{ 19 + Name: "nox", 20 + Usage: "Manage and decrypt app secrets", 21 + Flags: []cli.Flag{ 22 + &cli.StringFlag{ 23 + Name: "config", 24 + Value: constants.DefaultConfigPath, 25 + Usage: "path to config file", 26 + Destination: &configPath, 27 + }, 28 + }, 29 + Commands: []*cli.Command{ 30 + { 31 + Name: "run", 32 + Aliases: []string{"r"}, 33 + Usage: "Fetch, decrypt, and process app secrets", 34 + Action: func(ctx context.Context, cmd *cli.Command) error { 35 + cfg, err := config.Load(configPath) 36 + if err != nil { 37 + log.Fatalf("failed to load config: %v", err) 38 + } 39 + return process.ProcessApps(cfg) 40 + }, 41 + }, 42 + { 43 + Name: "validate", 44 + Aliases: []string{"v"}, 45 + Usage: "Validate configuration and secret integrity", 46 + Action: func(ctx context.Context, cmd *cli.Command) error { 47 + cfg, err := config.Load(configPath) 48 + if err != nil { 49 + log.Fatalf("failed to load config: %v", err) 50 + } 51 + return process.Validate(cfg) 52 + }, 53 + }, 54 + }, 55 + } 56 + 57 + if err := cmd.Run(context.Background(), os.Args); err != nil { 58 + log.Fatal(err) 59 + } 60 + }