Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VCS configuration via command line parameters #168

Closed
timobrembeck opened this issue Nov 5, 2021 · 2 comments
Closed

VCS configuration via command line parameters #168

timobrembeck opened this issue Nov 5, 2021 · 2 comments

Comments

@timobrembeck
Copy link
Contributor

I really love this tool, I just miss the ability to override the vcs options in the config file via the command line.

For example, in my CI workflow I want to bump the version and only commit & tag under certain conditions. It feels kind of hacky to change the config script via sed or similar when automating these tasks.

I would like to have the possibility to pass e.g. an option --commit/--no-commit to override anything configured in bumpver.toml. If you think that's a functionality more people would benefit from, I could give it a shot and open a PR for this.

@mbarkhau
Copy link
Owner

mbarkhau commented Nov 5, 2021

That sounds like a reasonable feature request.

The main thing to watch out for is to not change existing behaviour. In other words, if you would like to add --commit/--no-commit then this is not two states but three: (True, False, None).

Just spitballing, without considering other changes required in src/bumpver/cli.py.

# src/bumpver/config.py
def init(
    project_path  : typ.Union[str, pl.Path, None] = ".",
    cfg_missing_ok: bool = False,
    commit        : Optional[bool] = None,
) -> typ.Tuple[ProjectContext, MaybeConfig]:
    ctx = init_project_ctx(project_path)
    cfg = parse(ctx, cfg_missing_ok)
    if commit is not None:
        cfg = cfg._replace(commit=commit)
    return (ctx, cfg)

@mbarkhau
Copy link
Owner

mbarkhau commented Nov 7, 2021

@mbarkhau mbarkhau closed this as completed Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants