1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:27:35 +00:00

cal: Add the -y option to show the current year

Without `-y`, to show the current full year you'd have to specify which
one: `cal 2023`. Adding `-y` makes it possible to see the full current
year without remembering what year we are in.

This option is also stolen from FreeBSD :^)

Additionally, validate args: prevent passing both -3 and -y at the
same time. Passing both `--three-month-mode` and `--year` to `cal`
doesn't make sense. You'd either want the one or the other.
This commit is contained in:
Karol Baraniecki 2023-03-04 14:03:05 +01:00 committed by Andrew Kaster
parent dab82e1531
commit 190a6650bd
2 changed files with 11 additions and 2 deletions

View file

@ -5,7 +5,7 @@ cal - Display a calendar
## Synopsis
```**sh
$ cal [--starting-day weekday] [--three-month-view] [[month] year]
$ cal [--starting-day weekday] [--three-month-view] [--year] [[month] year]
```
## Description
@ -24,6 +24,7 @@ Days, months and years are specified with numbers. Week starts at Sunday.
* `-s`, `--starting-day`: Specify which day should start the week. Accepts either short or long weekday names or indexes (0 being Sunday).
* `-3`, `--three-month-view`: Display the previous, current, and next months side-by-side.
* `-y`, `--year`: Display an entire year by laying out months on a grid. If no year number is specified, the current year is used as a default.
## Examples