summary refs log tree commit diff stats
path: root/cmd/cetus/bpod.go
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-03-23 13:32:16 +0530
committerAndinus <andinus@nand.sh>2020-03-23 13:32:16 +0530
commita6b03fa4bb89a8f0c3546f720d5b35178c29f499 (patch)
treea0092511e85360e9a11578e530ccd751cee124ec /cmd/cetus/bpod.go
parent929e30adced38ac82f4482aa8c0c813e6fa2471b (diff)
downloadcetus-a6b03fa4bb89a8f0c3546f720d5b35178c29f499.tar.gz
Add notify functionality to cetus
Diffstat (limited to 'cmd/cetus/bpod.go')
-rw-r--r--cmd/cetus/bpod.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/cmd/cetus/bpod.go b/cmd/cetus/bpod.go
index f308d47..cf0a4bb 100644
--- a/cmd/cetus/bpod.go
+++ b/cmd/cetus/bpod.go
@@ -8,6 +8,7 @@ import (
 
 	"framagit.org/andinus/cetus/pkg/background"
 	"framagit.org/andinus/cetus/pkg/bpod"
+	"framagit.org/andinus/indus/notification"
 )
 
 func execBPOD() {
@@ -107,6 +108,18 @@ func execBPOD() {
 		bpod.Print(res)
 	}
 
+	// Send a desktop notification if notify flag was passed
+	if *bpodNotify {
+		n := notification.Notif{}
+		n.Title = res.Title
+		n.Message = fmt.Sprintf("%s\n\n%s",
+			res.StartDate,
+			res.Copyright)
+
+		err = n.Notify()
+		chkErr(err)
+	}
+
 	// Proceed only if the command was set because if it was fetch
 	// then it's already finished & should exit now.
 	if os.Args[1] == "fetch" {
l.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
//: Primitive to convert any type to text (array of characters).
//: Later layers will allow us to override this to do something smarter for
//: specific types.

:(before "End Primitive Recipe Declarations")
TO_TEXT,
:(before "End Primitive Recipe Numbers")
put(Recipe_ordinal, "to-text", TO_TEXT);
:(before "End Primitive Recipe Checks")
case TO_TEXT: {
  if (SIZE(inst.ingredients) != 1) {
    raise << maybe(get(Recipe, r).name) << "'to-text' requires a single ingredient, but got '" << to_original_string(inst) << "'\n" << end();
    break;
  }
  // can handle any type
  break;
}
:(before "End Primitive Recipe Implementations")
case TO_TEXT: {
  products.resize(1);
  products.at(0).push_back(/*alloc id*/0);
  products.at(0).push_back(new_mu_text(inspect(current_instruction().ingredients.at(0), ingredients.at(0))));
  break;
}