Skip to content

Commit

Permalink
Enable addition of multiple markdown files
Browse files Browse the repository at this point in the history
For the python cli, let specify multiple files rather than a single one.
  • Loading branch information
AbcSxyZ committed Jan 17, 2025
1 parent f4e9708 commit 63ff982
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Description of your event.
Add the event using:

```bash
python -m git_calendar --add [event.md]
python -m git_calendar --add event1.md [event2.md ...]
```

See help menu for more options:
Expand Down
8 changes: 5 additions & 3 deletions git_calendar/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ def main():
parser = argparse.ArgumentParser(description="Manage your git-based calendar.")
parser.add_argument(
"-a", "--add",
nargs="+",
metavar="FILENAME",
type=str,
help="Add an event from the specified markdown file."
help="Add events from the specified list of markdown files."
)
parser.add_argument(
"--regenerate",
Expand All @@ -29,8 +30,9 @@ def main():
calendar = GitCalendar(args.ics_file)

if args.add:
print(f"Adding event from file: {args.add}")
calendar.add_event(args.add)
for event_mdfile in args.add:
print(f"Adding event from file: {event_mdfile}")
calendar.add_event(event_mdfile)

if args.regenerate:
print("Regenerating calendar file.")
Expand Down

0 comments on commit 63ff982

Please sign in to comment.