commit-editor 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commit-editor
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: A terminal-based git commit message editor with opinionated formatting
5
5
  Author: Martin Prpič
6
6
  Author-email: Martin Prpič <martin.prpic@gmail.com>
@@ -26,8 +26,8 @@ Description-Content-Type: text/markdown
26
26
 
27
27
  # Commit Editor
28
28
 
29
- [![PyPI](https://img.shields.io/pypi/v/commit-editor.svg)](https://pypi.python.org/pypi/commit-editor)
30
- [![Python](https://img.shields.io/pypi/pyversions/commit-editor.svg)](https://pypi.python.org/pypi/commit-editor)
29
+ [![PyPI](https://img.shields.io/pypi/v/commit-editor.svg)](https://pypi.org/project/commit-editor/)
30
+ [![Python](https://img.shields.io/pypi/pyversions/commit-editor.svg)](https://pypi.org/project/commit-editor/)
31
31
  [![License](https://img.shields.io/pypi/l/commit-editor.svg)](https://github.com/mprpic/commit-editor/blob/main/LICENSE)
32
32
  [![CI](https://github.com/mprpic/commit-editor/workflows/CI/badge.svg)](https://github.com/mprpic/commit-editor/actions)
33
33
 
@@ -81,6 +81,9 @@ commit-editor path/to/file.txt
81
81
  | `Ctrl+Q` | Quit |
82
82
  | `Ctrl+O` | Toggle Signed-off-by trailer |
83
83
 
84
+ Additional key bindings are noted in the Textual
85
+ [`TextArea` documentation](https://textual.textualize.io/widgets/text_area/#bindings).
86
+
84
87
  ## Commit Message Format
85
88
 
86
89
  This editor enforces the widely-accepted git commit message conventions:
@@ -95,6 +98,7 @@ This editor enforces the widely-accepted git commit message conventions:
95
98
  - Word-level spellchecking
96
99
  - Config file support (`.commit.toml` project or global level or `pyproject.toml`); support tweaking line length limits
97
100
  - Jira (or other issue tracker) ID checking (e.g. title starts with `ABC-123: `)
101
+ - Color theme support
98
102
 
99
103
  ## License
100
104
 
@@ -1,7 +1,7 @@
1
1
  # Commit Editor
2
2
 
3
- [![PyPI](https://img.shields.io/pypi/v/commit-editor.svg)](https://pypi.python.org/pypi/commit-editor)
4
- [![Python](https://img.shields.io/pypi/pyversions/commit-editor.svg)](https://pypi.python.org/pypi/commit-editor)
3
+ [![PyPI](https://img.shields.io/pypi/v/commit-editor.svg)](https://pypi.org/project/commit-editor/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/commit-editor.svg)](https://pypi.org/project/commit-editor/)
5
5
  [![License](https://img.shields.io/pypi/l/commit-editor.svg)](https://github.com/mprpic/commit-editor/blob/main/LICENSE)
6
6
  [![CI](https://github.com/mprpic/commit-editor/workflows/CI/badge.svg)](https://github.com/mprpic/commit-editor/actions)
7
7
 
@@ -55,6 +55,9 @@ commit-editor path/to/file.txt
55
55
  | `Ctrl+Q` | Quit |
56
56
  | `Ctrl+O` | Toggle Signed-off-by trailer |
57
57
 
58
+ Additional key bindings are noted in the Textual
59
+ [`TextArea` documentation](https://textual.textualize.io/widgets/text_area/#bindings).
60
+
58
61
  ## Commit Message Format
59
62
 
60
63
  This editor enforces the widely-accepted git commit message conventions:
@@ -69,6 +72,7 @@ This editor enforces the widely-accepted git commit message conventions:
69
72
  - Word-level spellchecking
70
73
  - Config file support (`.commit.toml` project or global level or `pyproject.toml`); support tweaking line length limits
71
74
  - Jira (or other issue tracker) ID checking (e.g. title starts with `ABC-123: `)
75
+ - Color theme support
72
76
 
73
77
  ## License
74
78
 
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "commit-editor"
7
- version = "0.1.0"
7
+ version = "0.2.0"
8
8
  description = "A terminal-based git commit message editor with opinionated formatting"
9
9
  readme = "README.md"
10
10
  license = "MIT"
File without changes
@@ -304,13 +304,21 @@ class CommitEditorApp(App):
304
304
  """Disable editor actions when in prompt mode."""
305
305
  if self._prompt_mode is not None:
306
306
  # Allow only prompt-related actions
307
- if action in ("confirm_quit", "cancel_quit"):
307
+ if action in ("confirm_quit", "discard_quit", "cancel_quit"):
308
308
  return True
309
309
  return False
310
310
  return True
311
311
 
312
312
  def action_confirm_quit(self) -> None:
313
- """Confirm quit when prompted."""
313
+ """Save and quit when prompted."""
314
+ if self._prompt_mode == "quit_confirm":
315
+ self._prompt_mode = None
316
+ self.query_one("#message", MessageBar).clear()
317
+ self.action_save()
318
+ self.exit()
319
+
320
+ def action_discard_quit(self) -> None:
321
+ """Quit without saving when prompted."""
314
322
  if self._prompt_mode == "quit_confirm":
315
323
  self._prompt_mode = None
316
324
  self.query_one("#message", MessageBar).clear()
@@ -332,7 +340,11 @@ class CommitEditorApp(App):
332
340
  event.prevent_default()
333
341
  event.stop()
334
342
  self.action_confirm_quit()
335
- elif event.key in ("n", "escape"):
343
+ elif event.key == "n":
344
+ event.prevent_default()
345
+ event.stop()
346
+ self.action_discard_quit()
347
+ elif event.key == "escape":
336
348
  event.prevent_default()
337
349
  event.stop()
338
350
  self.action_cancel_quit()
@@ -398,7 +410,7 @@ class CommitEditorApp(App):
398
410
  editor = self.query_one("#editor", CommitTextArea)
399
411
  editor.read_only = True
400
412
  message_bar = self.query_one("#message", MessageBar)
401
- message_bar.show_prompt("Unsaved changes. Quit anyway? (y,n,esc)")
413
+ message_bar.show_prompt("Save changes? (y/n/esc)")
402
414
  else:
403
415
  self.exit()
404
416
 
@@ -1,3 +0,0 @@
1
- """A terminal-based git commit message editor with opinionated formatting."""
2
-
3
- __version__ = "0.1.0"