~psic4t/qcal

0d13a8bdd8cfb56a00a419502dbeb92c258a92d0 — psic4t 5 months ago bcda7ee
fix deletion behaviour
2 files changed, 8 insertions(+), 4 deletions(-)

M helpers.go
M main.go
M helpers.go => helpers.go +4 -0
@@ 208,6 208,10 @@ func deleteEvent(calNumber string, eventFilename string) (status string) {
	calNo, _ := strconv.ParseInt(calNumber, 0, 64)
	//fmt.Println(config.Calendars[calNo].Url + eventFilename)

	if eventFilename == "" {
		log.Fatal("No event filename given")
	}

	req, _ := http.NewRequest("DELETE", config.Calendars[calNo].Url+eventFilename, nil)
	req.SetBasicAuth(config.Calendars[calNo].Username, config.Calendars[calNo].Password)


M main.go => main.go +4 -4
@@ 254,8 254,8 @@ func main() {
	recurrence := flag.String("r", "", "Recurrency for new appointments. Use d,w,m,y with \"-n\"")
	showCalendars := flag.Bool("l", false, "List configured calendars with their corresponding numbers (for \"-c\")")
	appointmentFile := flag.String("u", "", "Upload appointment file. Provide filename and use with \"-c\"")
	appointmentDelete := flag.String("d", "", "Delete appointment. Get filename with \"-f\" and use with \"-c\"")
	appointmentDump := flag.String("dump", "", "Dump raw appointment data. Get filename with \"-f\" and use with \"-c\"")
	appointmentDelete := flag.String("delete", "", "Delete appointment. Get filename with \"-f\" and use with \"-c\"")
	appointmentDump := flag.String("d", "", "Dump raw appointment data. Get filename with \"-f\" and use with \"-c\"")
	appointmentEdit := flag.String("edit", "", "Edit + upload appointment data. Get filename with \"-f\" and use with \"-c\"")
	appointmentData := flag.String("n", "", "Add a new appointment. Check README.md for syntax")
	flag.Parse()


@@ 280,9 280,9 @@ func main() {
		getProp()
	} else if flagset["n"] {
		createAppointment(*calNumber, *appointmentData, *recurrence)
	} else if flagset["d"] {
	} else if flagset["delete"] {
		deleteEvent(*calNumber, *appointmentDelete)
	} else if flagset["dump"] {
	} else if flagset["d"] {
		dumpEvent(*calNumber, *appointmentDump, toFile)
	} else if flagset["p"] {
		displayICS()