File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -586,10 +586,16 @@ The following options are accepted:
586
586
or as an HTML document.
587
587
588
588
589
+ .. option :: --first-weekday WEEKDAY , -f WEEKDAY
590
+
591
+ The weekday to start each week.
592
+ Must be a number between 0 (Monday) and 6 (Sunday).
593
+ Defaults to 0.
594
+
595
+
589
596
.. option :: year
590
597
591
598
The year to print the calendar for.
592
- Must be a number between 1 and 9999.
593
599
Defaults to the current year.
594
600
595
601
Original file line number Diff line number Diff line change @@ -734,6 +734,11 @@ def main(args=None):
734
734
choices = ("text" , "html" ),
735
735
help = "output type (text or html)"
736
736
)
737
+ parser .add_argument (
738
+ "-f" , "--first-weekday" ,
739
+ type = int , default = 0 ,
740
+ help = "weekday (0 is Monday, 6 is Sunday) to start each week (default 0)"
741
+ )
737
742
parser .add_argument (
738
743
"year" ,
739
744
nargs = '?' , type = int ,
@@ -761,6 +766,7 @@ def main(arg
8000
s=None):
761
766
cal = LocaleHTMLCalendar (locale = locale )
762
767
else :
763
768
cal = HTMLCalendar ()
769
+ cal .setfirstweekday (options .first_weekday )
764
770
encoding = options .encoding
765
771
if encoding is None :
766
772
encoding = sys .getdefaultencoding ()
@@ -775,6 +781,7 @@ def main(args=None):
775
781
cal = LocaleTextCalendar (locale = locale )
776
782
else :
777
783
cal = TextCalendar ()
784
+ cal .setfirstweekday (options .first_weekday )
778
785
optdict = dict (w = options .width , l = options .lines )
779
786
if options .month is None :
780
787
optdict ["c" ] = options .spacing
Original file line number Diff line number Diff line change
1
+ Add option to calendar module CLI to specify the weekday to start each week.
2
+ Patch by Steven Ward.
You can’t perform that action at this time.
0 commit comments