Skip to content

Commit 27995d5

Browse files
authored
refactor: rename package and executable (#7)
1 parent 53d6ede commit 27995d5

File tree

7 files changed

+28
-21
lines changed

7 files changed

+28
-21
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@ jobs:
4343
with:
4444
github-token: ${{ secrets.GITHUB_TOKEN }}
4545
- name: Set version
46-
run: |
47-
poetry version "${{ needs.tag.outputs.new-version }}"
46+
run: poetry version "${{ needs.tag.outputs.new-version }}"
4847
- name: Publish
49-
run: |
50-
poetry publish --build
48+
run: poetry publish --build
5149
env:
5250
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# `draft(1)`
1+
# `git-draft(1)`
22

33
WIP

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ requires = ['poetry-core']
33
build-backend = 'poetry.core.masonry.api'
44

55
[tool.poetry]
6-
name = 'draft'
6+
name = 'git-draft'
77
version = '0.0.0' # Set programmatically
88
description = 'Version-controlled code assistant'
99
authors = ['Matthieu Monsch <[email protected]>']
1010
readme = 'README.md'
1111
repository = 'https://github.com/mtth/draft'
12-
packages = [{include = 'draft', from = 'src'}]
12+
packages = [{include = 'git_draft', from = 'src'}]
13+
14+
[tool.poetry.scripts]
15+
git-draft = 'git_draft.__main__:main'
1316

1417
[tool.poetry.dependencies]
1518
python = '>=3.12,<4'
Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
import optparse
44

5-
parser = optparse.OptionParser(prog="draft")
5+
6+
parser = optparse.OptionParser(prog="git-draft")
67

78
parser.disable_interspersed_args()
89

@@ -67,15 +68,20 @@ def __call__(self, _option, _opt, value, parser, name) -> None:
6768
Command.register("delete", help="delete the current draft")
6869

6970

70-
(opts, args) = parser.parse_args()
71-
command = getattr(opts, "command", None)
72-
if command == "create":
73-
print("Creating draft...")
74-
elif command == "prompt":
75-
print("Updating draft...")
76-
elif command == "apply":
77-
print("Applying draft...")
78-
elif command == "delete":
79-
print("Deleting draft...")
80-
else:
81-
parser.error("missing command")
71+
def main() -> None:
72+
(opts, args) = parser.parse_args()
73+
command = getattr(opts, "command", None)
74+
if command == "create":
75+
print("Creating draft...")
76+
elif command == "prompt":
77+
print("Updating draft...")
78+
elif command == "apply":
79+
print("Applying draft...")
80+
elif command == "delete":
81+
print("Deleting draft...")
82+
else:
83+
parser.error("missing command")
84+
85+
86+
if __name__ == "__main__":
87+
main()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import draft.backend as sut
1+
import git_draft.backend as sut
22

33

44
def test_backend():

0 commit comments

Comments
 (0)