Fix cli
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import argparse
|
||||
|
||||
import yaml
|
||||
from pydantic import ValidationError
|
||||
|
||||
from beaky.config import Config
|
||||
@@ -9,11 +10,14 @@ def main() -> None:
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="beaky"
|
||||
)
|
||||
parser.add_argument("path", help="Path to config file.")
|
||||
|
||||
parser.add_argument("--config", help="Path to config file.", default="config/application.yml")
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(args.config) as f:
|
||||
config_dict = yaml.safe_load(f)
|
||||
try:
|
||||
config = Config(**vars(args))
|
||||
config = Config(**config_dict)
|
||||
except ValidationError as e:
|
||||
print("Bad arguments")
|
||||
print(e)
|
||||
|
||||
Reference in New Issue
Block a user