Refactor command line argument parsing and handling for generating calendars
- Added a mutually exclusive group for the `--type` flag to specify the type of calendar to generate: weekly or monthly - Added two new arguments `--weekly` and `--monthly` to specify the type of calendar directly - Updated the default value for `--type` to be "weekly"
This commit is contained in:
parent
92cdf67db7
commit
541d69ef5d
1 changed files with 6 additions and 1 deletions
|
@ -123,13 +123,18 @@ def main():
|
||||||
required=False,
|
required=False,
|
||||||
default="%b %d, %Y",
|
default="%b %d, %Y",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
|
||||||
|
type_group = parser.add_mutually_exclusive_group()
|
||||||
|
type_group.add_argument(
|
||||||
"--type",
|
"--type",
|
||||||
"-t",
|
"-t",
|
||||||
help="Type of calendar to generate",
|
help="Type of calendar to generate",
|
||||||
required=False,
|
required=False,
|
||||||
|
choices=["weekly", "monthly"],
|
||||||
default="weekly",
|
default="weekly",
|
||||||
)
|
)
|
||||||
|
type_group.add_argument('--monthly', action='store_const', const='monthly', dest='type')
|
||||||
|
type_group.add_argument('--weekly', action='store_const', const='weekly', dest='type')
|
||||||
|
|
||||||
count_group = parser.add_mutually_exclusive_group()
|
count_group = parser.add_mutually_exclusive_group()
|
||||||
count_group.add_argument(
|
count_group.add_argument(
|
||||||
|
|
Loading…
Reference in a new issue