2020-06-24 17:15:19 +12:00

205 lines
23 KiB
Markdown

# cal
Use `cal` to display a calendar.
## Flags
* `-y`, `--year`: Display the year column
* `-q`, `--quarter`: Display the quarter column
* `-m`, `--month`: Display the month column
* `--full-year` \<integer>: Display a year-long calendar for the specified year
* `--week-start` \<string>: Display the calendar with the specified day as the first day of the week
* `--month-names`: Display the month names instead of integers
## Examples
```shell
> cal
───┬────────┬────────┬─────────┬───────────┬──────────┬────────┬──────────
# │ sunday │ monday │ tuesday │ wednesday │ thursday │ friday │ saturday
───┼────────┼────────┼─────────┼───────────┼──────────┼────────┼──────────
0 │ │ │ │ │ │ 12
13456789
210111213141516
317181920212223
424252627282930
531 │ │ │ │ │ │
───┴────────┴────────┴─────────┴───────────┴──────────┴────────┴──────────
```
```shell
> cal -yqm --full-year 2020
────┬──────┬─────────┬───────┬────────┬────────┬─────────┬───────────┬──────────┬────────┬──────────
# │ year │ quarter │ month │ sunday │ monday │ tuesday │ wednesday │ thursday │ friday │ saturday
────┼──────┼─────────┼───────┼────────┼────────┼─────────┼───────────┼──────────┼────────┼──────────
0202011 │ │ │ │ 1234
1202011567891011
220201112131415161718
320201119202122232425
4202011262728293031
5202012 │ │ │ │ │ │ │ 1
62020122345678
72020129101112131415
820201216171819202122
920201223242526272829
102020131234567
11202013891011121314
1220201315161718192021
1320201322232425262728
14202013293031 │ │ │ │
15202024 │ │ │ │ 1234
16202024567891011
1720202412131415161718
1820202419202122232425
192020242627282930 │ │
20202025 │ │ │ │ │ │ 12
212020253456789
2220202510111213141516
2320202517181920212223
2420202524252627282930
2520202531 │ │ │ │ │ │
26202026 │ │ 123456
2720202678910111213
2820202614151617181920
2920202621222324252627
30202026282930 │ │ │ │
31202037 │ │ │ │ 1234
32202037567891011
3320203712131415161718
3420203719202122232425
35202037262728293031
36202038 │ │ │ │ │ │ │ 1
372020382345678
382020389101112131415
3920203816171819202122
4020203823242526272829
412020383031 │ │ │ │ │
42202039 │ │ │ 12345
432020396789101112
4420203913141516171819
4520203920212223242526
4620203927282930 │ │ │
472020410 │ │ │ │ │ 123
48202041045678910
49202041011121314151617
50202041018192021222324
51202041025262728293031
5220204111234567
532020411891011121314
54202041115161718192021
55202041122232425262728
5620204112930 │ │ │ │ │
572020412 │ │ │ 12345
5820204126789101112
59202041213141516171819
60202041220212223242526
6120204122728293031 │ │
────┴──────┴─────────┴───────┴────────┴────────┴─────────┴───────────┴──────────┴────────┴──────────
```
```shell
> cal -yqm --full-year 2020 --month-names
────┬──────┬─────────┬───────────┬────────┬────────┬─────────┬───────────┬──────────┬────────┬──────────
# │ year │ quarter │ month │ sunday │ monday │ tuesday │ wednesday │ thursday │ friday │ saturday
────┼──────┼─────────┼───────────┼────────┼────────┼─────────┼───────────┼──────────┼────────┼──────────
0 │ 2020 │ 1 │ january │ │ │ │ 1 │ 2 │ 3 │ 4
1 │ 2020 │ 1 │ january │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11
2 │ 2020 │ 1 │ january │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18
3 │ 2020 │ 1 │ january │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25
4 │ 2020 │ 1 │ january │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │
5 │ 2020 │ 1 │ february │ │ │ │ │ │ │ 1
6 │ 2020 │ 1 │ february │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8
7 │ 2020 │ 1 │ february │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15
8 │ 2020 │ 1 │ february │ 16 │ 17 │ 18 │ 19 │ 20 │ 21 │ 22
9 │ 2020 │ 1 │ february │ 23 │ 24 │ 25 │ 26 │ 27 │ 28 │ 29
10 │ 2020 │ 1 │ march │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7
11 │ 2020 │ 1 │ march │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14
12 │ 2020 │ 1 │ march │ 15 │ 16 │ 17 │ 18 │ 19 │ 20 │ 21
13 │ 2020 │ 1 │ march │ 22 │ 23 │ 24 │ 25 │ 26 │ 27 │ 28
14 │ 2020 │ 1 │ march │ 29 │ 30 │ 31 │ │ │ │
15 │ 2020 │ 2 │ april │ │ │ │ 1 │ 2 │ 3 │ 4
16 │ 2020 │ 2 │ april │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11
17 │ 2020 │ 2 │ april │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18
18 │ 2020 │ 2 │ april │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25
19 │ 2020 │ 2 │ april │ 26 │ 27 │ 28 │ 29 │ 30 │ │
20 │ 2020 │ 2 │ may │ │ │ │ │ │ 1 │ 2
21 │ 2020 │ 2 │ may │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9
22 │ 2020 │ 2 │ may │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ 16
23 │ 2020 │ 2 │ may │ 17 │ 18 │ 19 │ 20 │ 21 │ 22 │ 23
24 │ 2020 │ 2 │ may │ 24 │ 25 │ 26 │ 27 │ 28 │ 29 │ 30
25 │ 2020 │ 2 │ may │ 31 │ │ │ │ │ │
26 │ 2020 │ 2 │ june │ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6
27 │ 2020 │ 2 │ june │ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13
28 │ 2020 │ 2 │ june │ 14 │ 15 │ 16 │ 17 │ 18 │ 19 │ 20
29 │ 2020 │ 2 │ june │ 21 │ 22 │ 23 │ 24 │ 25 │ 26 │ 27
30 │ 2020 │ 2 │ june │ 28 │ 29 │ 30 │ │ │ │
31 │ 2020 │ 3 │ july │ │ │ │ 1 │ 2 │ 3 │ 4
32 │ 2020 │ 3 │ july │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11
33 │ 2020 │ 3 │ july │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18
34 │ 2020 │ 3 │ july │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25
35 │ 2020 │ 3 │ july │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │
36 │ 2020 │ 3 │ august │ │ │ │ │ │ │ 1
37 │ 2020 │ 3 │ august │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8
38 │ 2020 │ 3 │ august │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15
39 │ 2020 │ 3 │ august │ 16 │ 17 │ 18 │ 19 │ 20 │ 21 │ 22
40 │ 2020 │ 3 │ august │ 23 │ 24 │ 25 │ 26 │ 27 │ 28 │ 29
41 │ 2020 │ 3 │ august │ 30 │ 31 │ │ │ │ │
42 │ 2020 │ 3 │ september │ │ │ 1 │ 2 │ 3 │ 4 │ 5
43 │ 2020 │ 3 │ september │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12
44 │ 2020 │ 3 │ september │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │ 19
45 │ 2020 │ 3 │ september │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │ 26
46 │ 2020 │ 3 │ september │ 27 │ 28 │ 29 │ 30 │ │ │
47 │ 2020 │ 4 │ october │ │ │ │ │ 1 │ 2 │ 3
48 │ 2020 │ 4 │ october │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10
49 │ 2020 │ 4 │ october │ 11 │ 12 │ 13 │ 14 │ 15 │ 16 │ 17
50 │ 2020 │ 4 │ october │ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24
51 │ 2020 │ 4 │ october │ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │ 31
52 │ 2020 │ 4 │ november │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7
53 │ 2020 │ 4 │ november │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14
54 │ 2020 │ 4 │ november │ 15 │ 16 │ 17 │ 18 │ 19 │ 20 │ 21
55 │ 2020 │ 4 │ november │ 22 │ 23 │ 24 │ 25 │ 26 │ 27 │ 28
56 │ 2020 │ 4 │ november │ 29 │ 30 │ │ │ │ │
57 │ 2020 │ 4 │ december │ │ │ 1 │ 2 │ 3 │ 4 │ 5
58 │ 2020 │ 4 │ december │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12
59 │ 2020 │ 4 │ december │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │ 19
60 │ 2020 │ 4 │ december │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │ 26
61 │ 2020 │ 4 │ december │ 27 │ 28 │ 29 │ 30 │ 31 │ │
────┴──────┴─────────┴───────────┴────────┴────────┴─────────┴───────────┴──────────┴────────┴──────────
```
```shell
> cal -ym --full-year 2303 --month-names | where month == "june"
───┬──────┬───────┬────────┬────────┬─────────┬───────────┬──────────┬────────┬──────────
# │ year │ month │ sunday │ monday │ tuesday │ wednesday │ thursday │ friday │ saturday
───┼──────┼───────┼────────┼────────┼─────────┼───────────┼──────────┼────────┼──────────
0 │ 2303 │ june │ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6
1 │ 2303 │ june │ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13
2 │ 2303 │ june │ 14 │ 15 │ 16 │ 17 │ 18 │ 19 │ 20
3 │ 2303 │ june │ 21 │ 22 │ 23 │ 24 │ 25 │ 26 │ 27
4 │ 2303 │ june │ 28 │ 29 │ 30 │ │ │ │
───┴──────┴───────┴────────┴────────┴─────────┴───────────┴──────────┴────────┴──────────
```
```shell
> cal -my --full-year 2020 --month-names | default friday 0 | where friday == 13
───┬──────┬──────────┬────────┬────────┬─────────┬───────────┬──────────┬────────┬──────────
# │ year │ month │ sunday │ monday │ tuesday │ wednesday │ thursday │ friday │ saturday
───┼──────┼──────────┼────────┼────────┼─────────┼───────────┼──────────┼────────┼──────────
0 │ 2020 │ march │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14
1 │ 2020 │ november │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14
───┴──────┴──────────┴────────┴────────┴─────────┴───────────┴──────────┴────────┴──────────
```
```shell
> cal -ymq --month-names --week-start monday
───┬──────┬─────────┬───────┬────────┬─────────┬───────────┬──────────┬────────┬──────────┬────────
# │ year │ quarter │ month │ monday │ tuesday │ wednesday │ thursday │ friday │ saturday │ sunday
───┼──────┼─────────┼───────┼────────┼─────────┼───────────┼──────────┼────────┼──────────┼────────
0 │ 2020 │ 2 │ june │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7
1 │ 2020 │ 2 │ june │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14
2 │ 2020 │ 2 │ june │ 15 │ 16 │ 17 │ 18 │ 19 │ 20 │ 21
3 │ 2020 │ 2 │ june │ 22 │ 23 │ 24 │ 25 │ 26 │ 27 │ 28
4 │ 2020 │ 2 │ june │ 29 │ 30 │ │ │ │ │
───┴──────┴─────────┴───────┴────────┴─────────┴───────────┴──────────┴────────┴──────────┴────────
```