Take config file as command line argument
This commit is contained in:
parent
4d5268cac1
commit
3c1afc7b73
@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
from datetime import datetime, timedelta
|
||||
import pathlib
|
||||
|
||||
from octorest import OctoRest
|
||||
from ruamel.yaml import YAML
|
||||
@ -37,10 +39,19 @@ def get_printer_job(calendar, printer):
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Process some integers.")
|
||||
parser.add_argument(
|
||||
"--config",
|
||||
type=pathlib.Path,
|
||||
default="printers.yaml",
|
||||
help="A yaml file defining printers to query (default: %(default)s)",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
calendar = CalendarService()
|
||||
|
||||
yaml = YAML(typ="safe")
|
||||
with open("printers.yaml") as f:
|
||||
with open(args.config) as f:
|
||||
printers = yaml.load(f)
|
||||
|
||||
for printer in printers:
|
||||
|
Loading…
Reference in New Issue
Block a user