mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 16:42:42 +01:00
release.py: Use click for the CLI
This commit is contained in:
parent
c0ef37c46a
commit
be778b8da0
2 changed files with 14 additions and 9 deletions
2
.github/workflows/make_release.yaml
vendored
2
.github/workflows/make_release.yaml
vendored
|
|
@ -21,7 +21,7 @@ jobs:
|
||||||
- name: Run version script
|
- name: Run version script
|
||||||
id: script
|
id: script
|
||||||
run: |
|
run: |
|
||||||
python extra/release.py "${{ inputs.version }}"
|
python extra/release.py bump "${{ inputs.version }}"
|
||||||
- uses: EndBug/add-and-commit@v9
|
- uses: EndBug/add-and-commit@v9
|
||||||
name: Commit the changes
|
name: Commit the changes
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,14 @@
|
||||||
|
|
||||||
"""A utility script for automating the beets release process.
|
"""A utility script for automating the beets release process.
|
||||||
"""
|
"""
|
||||||
import argparse
|
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
import click
|
||||||
|
|
||||||
BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
CHANGELOG = os.path.join(BASE, "docs", "changelog.rst")
|
CHANGELOG = os.path.join(BASE, "docs", "changelog.rst")
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
parser.add_argument("version", type=str)
|
|
||||||
|
|
||||||
# Locations (filenames and patterns) of the version number.
|
# Locations (filenames and patterns) of the version number.
|
||||||
VERSION_LOCS = [
|
VERSION_LOCS = [
|
||||||
|
|
@ -155,12 +154,18 @@ def datestamp():
|
||||||
f.write(line)
|
f.write(line)
|
||||||
|
|
||||||
|
|
||||||
def prep(args: argparse.Namespace):
|
@click.group()
|
||||||
|
def cli():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@cli.command()
|
||||||
|
@click.argument("version")
|
||||||
|
def bump(version: str) -> None:
|
||||||
# Version number bump.
|
# Version number bump.
|
||||||
datestamp()
|
datestamp()
|
||||||
bump_version(args.version)
|
bump_version(version)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
args = parser.parse_args()
|
cli()
|
||||||
prep(args)
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue