From 2a9fcaeed56554fbed8624795c337255f3eaa867 Mon Sep 17 00:00:00 2001 From: "zhangjun.1" Date: Wed, 8 Jul 2026 21:13:24 +0800 Subject: [PATCH] event description support rich text --- shortcuts/calendar/calendar_create.go | 6 +- shortcuts/calendar/calendar_update.go | 12 ++- .../references/lark-calendar-create.md | 3 +- .../references/lark-calendar-update.md | 8 +- .../calendar_description_rich_dryrun_test.go | 84 +++++++++++++++++++ 5 files changed, 106 insertions(+), 7 deletions(-) create mode 100644 tests/cli_e2e/calendar/calendar_description_rich_dryrun_test.go diff --git a/shortcuts/calendar/calendar_create.go b/shortcuts/calendar/calendar_create.go index effb5f677..7c787e8df 100644 --- a/shortcuts/calendar/calendar_create.go +++ b/shortcuts/calendar/calendar_create.go @@ -33,6 +33,9 @@ func buildEventData(runtime *common.RuntimeContext, startTs, endTs string) map[s if rrule := runtime.Str("rrule"); rrule != "" { eventData["recurrence"] = rrule } + if descriptionRich := runtime.Str("description-rich"); descriptionRich != "" { + eventData["description_rich"] = descriptionRich + } return eventData } @@ -99,7 +102,8 @@ var CalendarCreate = common.Shortcut{ {Name: "summary", Desc: "event title"}, {Name: "start", Desc: "start time (ISO 8601)", Required: true}, {Name: "end", Desc: "end time (ISO 8601)", Required: true}, - {Name: "description", Desc: "event description"}, + {Name: "description", Desc: "event description (plain text)"}, + {Name: "description-rich", Desc: "rich-text description as Markdown (@file or - for stdin); supports bold/italic/underline/strikethrough, links, and lists", Input: []string{common.File, common.Stdin}}, {Name: "attendee-ids", Desc: "attendee IDs, comma-separated (supports user ou_, chat oc_, room omm_)"}, {Name: "calendar-id", Desc: "calendar ID (default: primary)"}, {Name: "rrule", Desc: "recurrence rule (rfc5545)"}, diff --git a/shortcuts/calendar/calendar_update.go b/shortcuts/calendar/calendar_update.go index 17f9cc897..4d670383a 100644 --- a/shortcuts/calendar/calendar_update.go +++ b/shortcuts/calendar/calendar_update.go @@ -29,7 +29,8 @@ var CalendarUpdate = common.Shortcut{ {Name: "event-id", Desc: "event ID to update", Required: true}, {Name: "calendar-id", Desc: "calendar ID (default: primary)"}, {Name: "summary", Desc: "event title"}, - {Name: "description", Desc: "event description"}, + {Name: "description", Desc: "event description (plain text)"}, + {Name: "description-rich", Desc: "rich-text description as Markdown (@file or - for stdin); supports bold/italic/underline/strikethrough, links, and lists", Input: []string{common.File, common.Stdin}}, {Name: "start", Desc: "new start time (ISO 8601); requires --end"}, {Name: "end", Desc: "new end time (ISO 8601); requires --start"}, {Name: "rrule", Desc: "recurrence rule (rfc5545)"}, @@ -70,7 +71,7 @@ func validateCalendarUpdate(runtime *common.RuntimeContext) error { return err } if !hasCalendarUpdateOperation(runtime) { - return errs.NewValidationError(errs.SubtypeInvalidArgument, "nothing to update: specify at least one of --summary, --description, --start/--end, --rrule, --add-attendee-ids, or --remove-attendee-ids") + return errs.NewValidationError(errs.SubtypeInvalidArgument, "nothing to update: specify at least one of --summary, --description, --description-rich, --start/--end, --rrule, --add-attendee-ids, or --remove-attendee-ids") } return nil } @@ -114,6 +115,10 @@ func buildCalendarUpdateEventData(runtime *common.RuntimeContext) (map[string]in hasFields = true } } + if runtime.Cmd.Flags().Changed("description-rich") { + body["description_rich"] = runtime.Str("description-rich") + hasFields = true + } if runtime.Cmd.Flags().Changed("rrule") { rrule := strings.TrimSpace(runtime.Str("rrule")) if rrule != "" { @@ -353,6 +358,9 @@ func calendarUpdateResult(eventID string, event map[string]interface{}, addedCou if description, _ := event["description"].(string); description != "" { result["description"] = description } + if descriptionRich, _ := event["description_rich"].(string); descriptionRich != "" { + result["description_rich"] = descriptionRich + } if start := formatCalendarEventTime(event["start_time"]); start != "" { result["start"] = start } diff --git a/skills/lark-calendar/references/lark-calendar-create.md b/skills/lark-calendar/references/lark-calendar-create.md index 4036de2ba..a67daae86 100644 --- a/skills/lark-calendar/references/lark-calendar-create.md +++ b/skills/lark-calendar/references/lark-calendar-create.md @@ -32,7 +32,8 @@ lark-cli calendar +create --summary "..." --start "..." --end "..." \ | `--summary ` | 否 | 日程标题。注意:标题中不应该出现时间、地点、人物信息 | | `--start