Skip to content

Commit 63ff982

Browse files
committed
Enable addition of multiple markdown files
For the python cli, let specify multiple files rather than a single one.
1 parent f4e9708 commit 63ff982

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Description of your event.
4242
Add the event using:
4343

4444
```bash
45-
python -m git_calendar --add [event.md]
45+
python -m git_calendar --add event1.md [event2.md ...]
4646
```
4747

4848
See help menu for more options:

git_calendar/__main__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ def main():
66
parser = argparse.ArgumentParser(description="Manage your git-based calendar.")
77
parser.add_argument(
88
"-a", "--add",
9+
nargs="+",
910
metavar="FILENAME",
1011
type=str,
11-
help="Add an event from the specified markdown file."
12+
help="Add events from the specified list of markdown files."
1213
)
1314
parser.add_argument(
1415
"--regenerate",
@@ -29,8 +30,9 @@ def main():
2930
calendar = GitCalendar(args.ics_file)
3031

3132
if args.add:
32-
print(f"Adding event from file: {args.add}")
33-
calendar.add_event(args.add)
33+
for event_mdfile in args.add:
34+
print(f"Adding event from file: {event_mdfile}")
35+
calendar.add_event(event_mdfile)
3436

3537
if args.regenerate:
3638
print("Regenerating calendar file.")

0 commit comments

Comments
 (0)