4 ms·
I hacked up my own little bash script[1] to show the next 3 months with ncal like this: $ mcal June 2022 w| Mo Tu We Th Fr Sa Su
by ginko 4y ago
I hacked up my own little bash script[1] to show the next 3 months with ncal like this:
$ mcal
June 2022
w| Mo Tu We Th Fr Sa Su
22| 1 2 3 4 5
23| 6 7 8 9 10 11 12
24| 13 14 15 16 17 18 19
25| 20 21 22 23 24 25 26
26| 27 28 29 30
July 2022
w| Mo Tu We Th Fr Sa Su
26| 1 2 3
27| 4 5 6 7 8 9 10
28| 11 12 13 14 15 16 17
29| 18 19 20 21 22 23 24
30| 25 26 27 28 29 30 31
August 2022
w| Mo Tu We Th Fr Sa Su
31| 1 2 3 4 5 6 7
32| 8 9 10 11 12 13 14
33| 15 16 17 18 19 20 21
34| 22 23 24 25 26 27 28
35| 29 30 31
[1] https://pastebin.com/BNWynUZT https://pastebin.com/BNWynUZT
- panki27 4y ago`ncal -A2` will do the same, but show the months horizontally.
- sigtstp 4y agoI see there's a -v flag for vertical layout which matches horizontal listing better.
- amrtn 4y agoThe -v flag didn't work in my WSL. This worked: $ ncal -b -M -A2 June 2022 July 2022 August 2022 Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su 1 2 3 4 5 1 2 3 1 2 3 4 5 6 7 6 7 8 9 10 11 12 4 5 6 7 8 9 10 8 9 10 11 12 13 14 13 14 15 16 17 18 19 11 12 13 14 15 16 17 15 16 17 18 19 20 21 20 21 22 23 24 25 26 18 19 20 21 22 23 24 22 23 24 25 26 27 28 27 28 29 30 25 26 27 28 29 30 31 29 30 31
- k4rli 4y ago-v didn't work on 12.1.7+nmu3ubuntu1 and -M does nothing seemingly. `ncal -b -A2` looks very good.
- amrtn 4y ago-M sets the first day of the week to Monday. If in your locale the weeks already begin on Monday you are not going to see much difference on the output.
- sigtstp 4y agoAh, my bad. I'm on Arch and it packages cal, not ncal. Wasn't familiar with it and it looks like the flags are different. Because why not...
- sigtstp 4y agoNeat! I was thinking of hacking something for org-mode (to support creating events and gcal sync) but this is definitely good for quick lookup.
- tragomaskhalos 4y agoNot being aware of ncal, but based on long experience of bash, I anticipated a fiendish and impenetrable 300 line monster full of arcana to crank this out from first principles. So this was a very elegant surprise :)
- dotancohen 4y agoIf you're interested, I can share my khal config with you. It also displays 3 months, and syncs (via vdirsyncer) with Nextcloud to show my personal and work calendar events, all right there in the terminal.
- kej 4y agoNot the person you replied to, but I'm interested and would like more info on your setup.
- dotancohen 4y agoIn general, I use vdirsync to sync my contacts and calendars locally, keeping the remote system's values to resolve conflicts as I intend to only read the values from the CLI. Vdirsync uses an application-agnostic format, so I could in theory read from any application that supports standard file formats: $ cat ~/.vdirsyncer/config [general] status_path = "~/.vdirsyncer/status/" # Contacts [storage contacts_personal_local] type = "filesystem" path = "~/.vdirsyncer/contacts/" fileext = ".vcf" [storage contacts_personal_remote] type = "carddav" url = "https://example.com/remote.php/carddav/" username = "bloodninja" password = "hunter2" [pair contacts_personal] a = "contacts_personal_local" b = "contacts_personal_remote" collections = ["from a", "from b"] conflict_resolution = "b wins" # Calendars [storage calendar_personal_local] type = "filesystem" path = "~/.vdirsyncer/calendars/" fileext = ".ics" [storage calendar_personal_remote] type = "caldav" url = "https://example.com/remote.php/caldav/" username = "bloodninja" password = "hunter2" [pair calendars_personal] a = "calendar_personal_local" b = "calendar_personal_remote" collections = ["from a", "from b"] conflict_resolution = "b wins" metadata = ["color"] Then I set up khal to read from the directory that vdirsync stores data in, and display three months with events and use the ISO-8601 date format: $ cat ~/.config/khal/config [calendars] [[personal]] path = ~/.vdirsyncer/calendars/* type = discover [default] default_calendar = personal highlight_event_days = True timedelta = 45d [locale] firstweekday = 6 timeformat = %H:%M dateformat = %Y-%m-%d longdateformat = %Y-%m-%d datetimeformat = %Y-%m-%d %H:%M longdatetimeformat = %Y-%m-%d %H:%M default_timezone = Asia/Jerusalem unicode_symbols = False [highlight_days] color = light green method = fg If you have any questions or suggestions I'll be watching this thread.
- Schiphol 4y agothere's also `cal`, in the util-linux package. cal -3 May 2022 June 2022 July 2022 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 1 2 3 4 1 2 8 9 10 11 12 13 14 5 6 7 8 9 10 11 3 4 5 6 7 8 9 15 16 17 18 19 20 21 12 13 14 15 16 17 18 10 11 12 13 14 15 16 22 23 24 25 26 27 28 19 20 21 22 23 24 25 17 18 19 20 21 22 23 29 30 31 26 27 28 29 30 24 25 26 27 28 29 30 31
- dolmen 4y agoOn MacOS: $ LANG=C cal -3 May 2022 June 2022 July 2022 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 1 2 3 4 1 2 8 9 10 11 12 13 14 5 6 7 8 9 10 11 3 4 5 6 7 8 9 15 16 17 18 19 20 21 12 13 14 15 16 17 18 10 11 12 13 14 15 16 22 23 24 25 26 27 28 19 20 21 22 23 24 25 17 18 19 20 21 22 23 29 30 31 26 27 28 29 30 24 25 26 27 28 29 30 31
- ginko 4y agoWell, cal -3 shows the previous and next month, but I wanted this month and the next two months. I also wanted them arranged vertically and with week numbers. (And with weeks starting on Monday)
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- jayknight 4y agoEvery year, I use `cal` to generate the calendar like this for the year, paste that into word and do some minor formatting (dim weekends and holidays, bold paydays) and print it and put it on my office wall. I reference it all the time just to re-orient myself to where I am in the month/year, etc.
- aidenn0 4y agoUsing cal from util-linux; if you are okay with horizontal: cal -w -n3 If you must have vertical: cal -w today; cal -w '+1 month'; cal -w '+2 month' Output: June 2022 Mo Tu We Th Fr Sa Su 22 1 2 3 4 5 23 6 7 8 9 10 11 12 24 13 14 15 16 17 18 19 25 20 21 22 23 24 25 26 26 27 28 29 30 July 2022 Mo Tu We Th Fr Sa Su 26 1 2 3 27 4 5 6 7 8 9 10 28 11 12 13 14 15 16 17 29 18 19 20 21 22 23 24 30 25 26 27 28 29 30 31 August 2022 Mo Tu We Th Fr Sa Su 31 1 2 3 4 5 6 7 32 8 9 10 11 12 13 14 33 15 16 17 18 19 20 21 34 22 23 24 25 26 27 28 35 29 30 31