I just discovered this much more powerful GNU gcal program. It has a lot of features that cal doesn’t have. My base command to list calendar is:
% cal -3s December 2010 January 2011 February 2011 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 1 1 2 3 4 5 5 6 7 8 9 10 11 2 3 4 5 6 7 8 6 7 8 9 10 11 12 12 13 14 15 16 17 18 9 10 11 12 13 14 15 13 14 15 16 17 18 19 19 20 21 22 23 24 25 16 17 18 19 20 21 22 20 21 22 23 24 25 26 26 27 28 29 30 31 23 24 25 26 27 28 29 27 28 30 31
The command for the similar result using gcal is:
% gcal . 2010/2011 December January February 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 1 1 2 3 4 5 5 6 7 8 9 10 11 2 3 4 5 6 7 8 6 7 8 9 10 11 12 12 13 14 15 16 17 18 9 10 11 12 13 14 15 13 14 15 16 17 18 19 19 20 21 22 23 24 25 16 17 18 19 20 21 22 20 21 22 23 24 25 26 26 27 28 29 30 31 23 24 25 26 27 28 29 27 28 30 31
My old dzen script showed 3-month calendar in this way:
Now it’s much better:
And the code is sort of simpler, you can see the diff. The basic command is
gcal --cc-holiday=TW+US_NY --holiday-list=short --highlighting=\<:\>:[:] .
First arguments lists what country holidays I need, I use two, Taiwan and New York State of US, you can use plus sign + to list more than one. I also change the highlighting characters, so I can do some dzen syntax later. I tried to give it a string instead of single character, but gcal doesn’t accept that. So I used <>[] which don’t seem to be used by gcal itself, then used sed to replace with the strings I really need. You can use same method for ANSI color escape code if you want. Note that the last period . is for 3-month format. There are more information in its info page, info gcal, or you can run gcal -hh -p.
I think the most amazing part of gcal is you can have a holiday list. I think you can also import your schedule from some source with a bit of coding help. But I don’t have such need, therefore I didn’t dig in.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.