Skip to content

Commit

Permalink
Small change to parameters of load_config
Browse files Browse the repository at this point in the history
Pass need parameters instead of the argparse args object.

Signed-off-by: Eric Brown <[email protected]>
  • Loading branch information
ericwb committed Oct 26, 2024
1 parent 5f1029e commit 6b4902f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions precli/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ def setup_arg_parser():
return args


def load_config(args) -> dict:
if args.config:
return tomllib.load(args.config)
def load_config(config: dict, targets: list[str]) -> dict:
if config:
return tomllib.load(config)
else:
default_confs = (".precli.toml", "precli.toml", "pyproject.toml")
for target in filter(os.path.isdir, args.targets):
for target in filter(os.path.isdir, targets):
for conf in default_confs:
path = pathlib.Path(target) / conf
if path.exists():
Expand Down Expand Up @@ -367,7 +367,7 @@ def main():
args = setup_arg_parser()

# Load optional configuration file
config = load_config(args)
config = load_config(args.config, args.targets)

# CLI enabled/disabled override any config in files
config["enabled"] = (
Expand Down

0 comments on commit 6b4902f

Please sign in to comment.