this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: parse CLI flags

Khue Doan d6399ef3 2efaab5a

+38 -2
+6 -2
Makefile
··· 4 4 default: build 5 5 6 6 build: 7 - nix build 7 + nix build . 8 8 9 9 dev: 10 - nix run 10 + nix run . -- \ 11 + --installer ./examples#installer \ 12 + --flake ./examples \ 13 + --hosts ./examples/hosts.json \ 14 + --ssh-key ~/.ssh/id_ed25519 11 15 12 16 test: 13 17 nix flake check
+32
cmd/nixie/main.go
··· 1 1 package main 2 2 3 3 import ( 4 + "flag" 4 5 "fmt" 6 + "log" 5 7 ) 6 8 9 + type Config struct { 10 + Address string 11 + Debug bool 12 + Flake string 13 + HostsFile string 14 + Installer string 15 + SSHKey string 16 + } 17 + 18 + func parseFlags() Config { 19 + var config Config 20 + 21 + flag.BoolVar(&config.Debug, "debug", false, "Enable debug logging") 22 + flag.StringVar(&config.Address, "address", "0.0.0.0", "Address to listen on") 23 + flag.StringVar(&config.Flake, "flake", "", "NixOS configuration flake (for example, .)") 24 + flag.StringVar(&config.HostsFile, "hosts", "", "Path to hosts.json file (for example, ./hosts.json)") 25 + flag.StringVar(&config.Installer, "installer", "", "NixOS installer flake output (for example, .#installer)") 26 + flag.StringVar(&config.SSHKey, "ssh-key", "", "Path to the SSH private key (for example, ~/.ssh/id_ed25519)") 27 + 28 + flag.Parse() 29 + 30 + if config.HostsFile == "" || config.Flake == "" || config.Installer == "" { 31 + log.Fatal("Usage: nixie --hosts <hosts.json> --flake <flake> --installer <installer-output>") 32 + } 33 + 34 + return config 35 + } 36 + 7 37 func main() { 38 + config := parseFlags() 8 39 fmt.Println("TODO nixie CLI") 40 + fmt.Printf("%+v\n", config) 9 41 }