diff options
| author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2025-11-25 09:05:02 +0100 |
|---|---|---|
| committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2025-11-25 09:05:02 +0100 |
| commit | 65ab0113703d634e932bf89f5079fc730bb3ac84 (patch) | |
| tree | 82620119967e20e27e7fe96079e4f642c659df95 | |
| parent | bf846bc55a650e11980a14062a023ac4fb8b1663 (diff) | |
Add support for writing files to a different directory
| -rwxr-xr-x | planner/planner_generator.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/planner/planner_generator.py b/planner/planner_generator.py index 2da3133..3da58ce 100755 --- a/planner/planner_generator.py +++ b/planner/planner_generator.py @@ -47,6 +47,7 @@ class Generator: latitude: Optional[float] = None, longitude: Optional[float] = None, timezone: Optional[str] = None, + outdir: Optional[str] = ".", ): self.year = year or ( datetime.date.today() + datetime.timedelta(days=334) @@ -60,6 +61,7 @@ class Generator: self.out_file = out_file or ( template or self.default_template ) + "-" + lang_name + ".pdf" + self.out_file = os.path.join(outdir, self.out_file) if not template: template = self.default_template @@ -484,6 +486,11 @@ class Command: help="Timezone for ephemeris calculation (e.g. Europe/Rome)", ) parser.add_argument( + "--outdir", + default='.', + help="Directory to write the generated file to", + ) + parser.add_argument( "command", ) return parser @@ -507,6 +514,7 @@ class Command: latitude=self.args.latitude, longitude=self.args.longitude, timezone=self.args.timezone, + outdir=self.args.outdir, ).run() else: print("command not supported: {}".format(self.args.command)) |
