diff --git a/bar/run.go b/bar/run.go index 84a7f969a6743c840bdee95f83fc1c6dee5b0e37..a4761ffd414b0e569f859d0f6ae36fc9746cd324 100644 --- a/bar/run.go +++ b/bar/run.go @@ -30,24 +30,7 @@ func handleCommands() { func Run(cmd *cobra.Command, args []string) { viper.BindPFlags(cmd.Flags()) cfg, err := config.ReadConfig(viper.GetString("config")) - if err != nil { - // TODO Make a better default - cfg, err = config.ReadConfigStr(`--- -refresh: 5 -modules: - - module: text - name: post - params: - text: "post" - color: "#11ff11" - on-click: xdg-open https://mastodon.ie/ - - module: date - params: - format: 06-05-04 15:02 - on-click: xdg-open https://calendar.google.com/ -`) - cobra.CheckErr(err) - } + cobra.CheckErr(err) if cfg.Refresh < 1 { cfg.Refresh = 5 } diff --git a/modules/modules.go b/modules/modules.go index 216064ad0f3b54089e011b3dd3ad48d6e0ffa2b0..ea2ff2549debea2276a4d3ba5dc935b9e9cf3f32 100644 --- a/modules/modules.go +++ b/modules/modules.go @@ -1,6 +1,8 @@ package modules import ( + "fmt" + "gopkg.in/yaml.v3" ) @@ -41,7 +43,7 @@ func (m *Module) UnmarshalYAML(node *yaml.Node) error { case "text": m.Params = NewText(m) default: - panic("module unknown") + return fmt.Errorf("module '%s' is unknown", params.Module) } return params.Params.Decode(m.Params) }