summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/run.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/run.go b/internal/run.go
new file mode 100644
index 0000000..ccfa8a9
--- /dev/null
+++ b/internal/run.go
@@ -0,0 +1,23 @@
+package internal
+
+func Run(configFile string) {
+ config, err := newConfig(configFile)
+ if err != nil {
+ panic(err)
+ }
+
+ state, err := readState(config)
+ if err != nil {
+ notifyError(config, err)
+ }
+
+ state = execute(state, config)
+
+ if err := state.persist(); err != nil {
+ notifyError(config, err)
+ }
+
+ if subject, body, changed := state.report(); changed {
+ notify(config, subject, body)
+ }
+}