summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-04-19 01:22:02 +0300
committerPaul Buetow <paul@buetow.org>2023-04-19 01:22:02 +0300
commit5417f23c40463a1e1ad6d93d1ab69f3590d1b72b (patch)
tree5e6a5b00dbbb1f304bb607255b7aec1d910c74e4 /internal
parent7d8c955fe2eaa5551f2f832ab0c5a5920388712b (diff)
add run.
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)
+ }
+}