Beispiel #1
0
// add creates an entry and posts it to the server
func add() {
	e := entry.Entry{Msg: *msg}
	e.SetDuration(*dur)
	jsonRequest("POST", "/entries", &e)

	fmt.Println("Activity Added:", e.Msg, "|", e.TimeString())
}
Beispiel #2
0
// edit updates an existing entry and then saves it to the server.
func edit() {
	var e entry.Entry
	path := fmt.Sprintf("/entries/%d", id)
	jsonRequest("GET", path, &e)
	e.Msg = *msg
	e.SetDuration(*dur)
	jsonRequest("PUT", path, &e)
}