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

Don't exit during a dry run? #14

Open
jean opened this issue Feb 12, 2020 · 1 comment
Open

Don't exit during a dry run? #14

jean opened this issue Feb 12, 2020 · 1 comment
Labels
enhancement New feature or enhancement for labels

Comments

@jean
Copy link
Contributor

jean commented Feb 12, 2020

I'm using labels in an unorthodox way: I'm driving it from another package.
Specifically, I'm spreading out updates over groups of repositories:

    for repo in open(Path(group) / 'repos.txt').readlines():
        repo = repo.strip()
        workfile = Path(group) / 'workdir' / f'{repo}.toml'
        context.invoke(labels_cli.fetch_cmd, owner='...', repo=repo, filename=workfile)
        merge_labels(Path(group) / 'labels_to_update.toml', workfile)
        delete_labels(Path(group) / 'labels_to_delete.txt', workfile)
        # This may fail with labels that really require merging:
        context.invoke(labels_cli.sync_cmd, owner='...', repo=repo, filename=workfile, dryrun=dryrun)
    if not dryrun:
        rename_standard_labels(Path(group) / 'labels_to_update.toml')

This stops after the first iteration due to this line.

  • Would it be OK to just turn that into a return?
  • The reason why I'm invoking commands is that a lot of work is done in the *_cmd implementations, specifically sync_cmd. Maybe it's worthwhile moving this out to labels/commands.py or someplace, to make labels more amenable to use as library. Does this make sense?
@hackebrot
Copy link
Owner

Hi @jean! 👋

Moving the command implementations excluding IO operations to a separate module seems reasonable. 👍

@hackebrot hackebrot added the enhancement New feature or enhancement for labels label Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement for labels
Projects
None yet
Development

No branches or pull requests

2 participants