❄ Personal NixOS Flake Manager
nixos home-manager go nix
0
fork

Configure Feed

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

feat(rui): top-level configuration initialisation

Fuwn 92a86b59 11010b69

+24 -16
+24 -16
rui.go
··· 10 10 "github.com/urfave/cli/v2" 11 11 ) 12 12 13 + type Configuration struct { 14 + Notify bool `json:"notify"` 15 + } 16 + 17 + var configuration Configuration 18 + 19 + func init() { 20 + configurationPath := os.Getenv("RUI_CONFIG") 21 + 22 + if configurationPath == "" { 23 + configurationPath = os.Getenv("XDG_CONFIG_HOME") + "/rui/config.json" 24 + } 25 + 26 + content, err := os.ReadFile(configurationPath) 27 + 28 + if err != nil { 29 + return 30 + } 31 + 32 + if err := json.Unmarshal(content, &configuration); err != nil { 33 + return 34 + } 35 + } 36 + 13 37 func main() { 14 38 (&cli.App{ 15 39 Name: "rui", ··· 206 230 return cmd.Run() 207 231 } 208 232 209 - type Configuration struct { 210 - Notify bool `json:"notify"` 211 - } 212 - 213 233 func Notify(message string) error { 214 - content, err := os.ReadFile(os.Getenv("XDG_CONFIG_HOME")) 215 - 216 - if err != nil { 217 - return err 218 - } 219 - 220 - var configuration Configuration 221 - 222 - if err := json.Unmarshal(content, &configuration); err != nil { 223 - return err 224 - } 225 - 226 234 notifySend, err := exec.LookPath("notify-send") 227 235 228 236 if err != nil {