diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2e80eb6..4d7fcc8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -43,10 +43,8 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} - name: Set version - run: | - poetry version "${{ needs.tag.outputs.new-version }}" + run: poetry version "${{ needs.tag.outputs.new-version }}" - name: Publish - run: | - poetry publish --build + run: poetry publish --build env: POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} diff --git a/README.md b/README.md index 26dc0db..68b17f7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# `draft(1)` +# `git-draft(1)` WIP diff --git a/pyproject.toml b/pyproject.toml index 4711c7f..82d25ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,13 +3,16 @@ requires = ['poetry-core'] build-backend = 'poetry.core.masonry.api' [tool.poetry] -name = 'draft' +name = 'git-draft' version = '0.0.0' # Set programmatically description = 'Version-controlled code assistant' authors = ['Matthieu Monsch '] readme = 'README.md' repository = 'https://github.com/mtth/draft' -packages = [{include = 'draft', from = 'src'}] +packages = [{include = 'git_draft', from = 'src'}] + +[tool.poetry.scripts] +git-draft = 'git_draft.__main__:main' [tool.poetry.dependencies] python = '>=3.12,<4' diff --git a/src/draft/__init__.py b/src/git_draft/__init__.py similarity index 100% rename from src/draft/__init__.py rename to src/git_draft/__init__.py diff --git a/src/draft/__main__.py b/src/git_draft/__main__.py similarity index 77% rename from src/draft/__main__.py rename to src/git_draft/__main__.py index 774c74e..b307ab3 100644 --- a/src/draft/__main__.py +++ b/src/git_draft/__main__.py @@ -2,7 +2,8 @@ import optparse -parser = optparse.OptionParser(prog="draft") + +parser = optparse.OptionParser(prog="git-draft") parser.disable_interspersed_args() @@ -67,15 +68,20 @@ def __call__(self, _option, _opt, value, parser, name) -> None: Command.register("delete", help="delete the current draft") -(opts, args) = parser.parse_args() -command = getattr(opts, "command", None) -if command == "create": - print("Creating draft...") -elif command == "prompt": - print("Updating draft...") -elif command == "apply": - print("Applying draft...") -elif command == "delete": - print("Deleting draft...") -else: - parser.error("missing command") +def main() -> None: + (opts, args) = parser.parse_args() + command = getattr(opts, "command", None) + if command == "create": + print("Creating draft...") + elif command == "prompt": + print("Updating draft...") + elif command == "apply": + print("Applying draft...") + elif command == "delete": + print("Deleting draft...") + else: + parser.error("missing command") + + +if __name__ == "__main__": + main() diff --git a/src/draft/backend.py b/src/git_draft/backend.py similarity index 100% rename from src/draft/backend.py rename to src/git_draft/backend.py diff --git a/tests/draft/backend_test.py b/tests/git_draft/backend_test.py similarity index 59% rename from tests/draft/backend_test.py rename to tests/git_draft/backend_test.py index f9877a8..72360a7 100644 --- a/tests/draft/backend_test.py +++ b/tests/git_draft/backend_test.py @@ -1,4 +1,4 @@ -import draft.backend as sut +import git_draft.backend as sut def test_backend():