Skip to content

readalongs -c switch should validate file contents, not extension #140

@joanise

Description

@joanise

Right now, the config.json file passed through -c must have the .json extension. That's overly picky. We ought to accept any file that's valid JSON.

This by itself would be enough in cli.py:

            try:
                with open(config_file, encoding="utf-8-sig") as f:
                    config = json.load(f)
            except json.decoder.JSONDecodeError as e:
                raise click.BadParameter(
                    f"Config file at {config_file} is not in valid JSON format: {e}."
                ) from e

we don't really need to wrap it in if str(config_file).endswith("json"): as we do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions