|
| 1 | +namespace FsSpectre |
| 2 | + |
| 3 | +open System |
| 4 | +open Spectre.Console |
| 5 | + |
| 6 | +[<AutoOpen>] |
| 7 | +module CalendarEventBuilder = |
| 8 | + |
| 9 | + type CalendarEventBuilder() = |
| 10 | + member __.Yield _ = |
| 11 | + let now = DateTime.Now |
| 12 | + CalendarEvent(now.Year, now.Month, now.Day) |
| 13 | + |
| 14 | + [<CustomOperation "year">] |
| 15 | + member __.Year(calendarEvent: CalendarEvent, year: int) = |
| 16 | + CalendarEvent(calendarEvent.Description, year, calendarEvent.Month, calendarEvent.Day) |
| 17 | + |
| 18 | + [<CustomOperation "month">] |
| 19 | + member __.Month(calendarEvent: CalendarEvent, month: int) = |
| 20 | + CalendarEvent(calendarEvent.Description, calendarEvent.Year, month, calendarEvent.Day) |
| 21 | + |
| 22 | + [<CustomOperation "day">] |
| 23 | + member __.Day(calendarEvent: CalendarEvent, day: int) = |
| 24 | + CalendarEvent(calendarEvent.Description, calendarEvent.Year, calendarEvent.Month, day) |
| 25 | + |
| 26 | + [<CustomOperation "year_month_day">] |
| 27 | + member __.Year(calendarEvent: CalendarEvent, year: int, month: int, day: int) = |
| 28 | + CalendarEvent(calendarEvent.Description, year, month, day) |
| 29 | + |
| 30 | + [<CustomOperation "description">] |
| 31 | + member __.Description(calendarEvent: CalendarEvent, description: string) = |
| 32 | + CalendarEvent(description, calendarEvent.Year, calendarEvent.Month, calendarEvent.Day) |
| 33 | + |
| 34 | + let calendarEvent = CalendarEventBuilder() |
0 commit comments