git-commitflow 1.1.1__tar.gz → 1.1.3__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: git-commitflow
3
- Version: 1.1.1
3
+ Version: 1.1.3
4
4
  Summary: A git add/commit/push helper
5
5
  Home-page: https://github.com/jamescherti/git-commitflow
6
6
  Author: James Cherti
@@ -372,17 +372,19 @@ class GitCommitFlow:
372
372
 
373
373
  print(f"Author: {Fore.YELLOW + git_author + Fore.RESET} ")
374
374
  print("Branch:", Fore.YELLOW + self.branch + Fore.RESET)
375
- # print("Git message: ", end="")
376
375
 
377
376
  # commit_message = self.git_config_get("custom.commit-message").strip()
378
377
  # previous_message = ""
379
378
  # if commit_message:
380
379
  # print(Fore.YELLOW + commit_message + Fore.RESET)
381
- # elif self.amount_commits > 0:
382
- # previous_message = \
383
- # "\n".join(
384
- # self._run("git --no-pager log -1 --pretty=%B")).rstrip()
385
- # print(Fore.YELLOW + previous_message + Fore.RESET)
380
+
381
+ if self.amount_commits > 0:
382
+ previous_message = \
383
+ "\n".join(
384
+ self._run("git --no-pager log -1 --pretty=%B")).rstrip()
385
+ print("Previous git message:",
386
+ Fore.YELLOW + previous_message + Fore.RESET)
387
+ self.readline_manager.append_to_history(previous_message)
386
388
 
387
389
  # commit_message = self.prompt_git_commit_message(commit_message)
388
390
  commit_message = self.prompt_git_commit_message("")
@@ -21,18 +21,16 @@
21
21
 
22
22
  import logging
23
23
  import readline
24
- import sys
25
24
  from pathlib import Path
26
- from typing import List, Optional, Set, Union
27
25
 
28
26
 
29
27
  class ReadlineSimpleCompleter:
30
- def __init__(self, options: List[str]):
28
+ def __init__(self, options: list[str]):
31
29
  """Initialize with a sorted list of options."""
32
30
  self.complete_with = sorted(options)
33
- self.matches: List[str] = []
31
+ self.matches: list[str] = []
34
32
 
35
- def complete(self, _, state: int) -> Optional[str]:
33
+ def complete(self, _, state: int):
36
34
  """Return the next possible completion for 'text'."""
37
35
  if state == 0:
38
36
  orig_line = readline.get_line_buffer()
@@ -46,13 +44,13 @@ class ReadlineSimpleCompleter:
46
44
 
47
45
 
48
46
  class ReadlineManager:
49
- def __init__(self, history_file: Union[str, Path, None] = None,
47
+ def __init__(self, history_file=None,
50
48
  history_length=-1):
51
49
  """Manage readline settings, history, and input."""
52
50
  self.history_file = Path(history_file) if history_file else None
53
- self.keywords: Set[str] = set()
51
+ self.keywords = set()
54
52
  self.history_length = history_length
55
- self.history = []
53
+ # self.history = []
56
54
  self._init_history()
57
55
 
58
56
  def _init_history(self):
@@ -64,7 +62,7 @@ class ReadlineManager:
64
62
  readline.set_history_length(self.history_length)
65
63
 
66
64
  # History
67
- readline.read_history_file(self.history_file)
65
+ self.read_history_file()
68
66
 
69
67
  # Keywords
70
68
  # if self.history_file and self.history_file.exists():
@@ -77,7 +75,8 @@ class ReadlineManager:
77
75
  logging.debug("[DEBUG] History loaded")
78
76
 
79
77
  def append_to_history(self, string):
80
- self.history.append(string)
78
+ # self.history.append(string)
79
+ readline.add_history(string)
81
80
 
82
81
  # # Truncate history
83
82
  # if self.history_length >= 0 \
@@ -90,7 +89,12 @@ class ReadlineManager:
90
89
  # with open(self.history_file, "a", encoding="utf-8") as fhandler:
91
90
  # fhandler.write(f"{string}\n")
92
91
 
93
- def _save_history(self):
92
+ def read_history_file(self):
93
+ """Read the current readline history to the specified file."""
94
+ if self.history_file:
95
+ readline.read_history_file(self.history_file)
96
+
97
+ def save_history_file(self):
94
98
  """Save the current readline history to the specified file."""
95
99
  if self.history_file:
96
100
  logging.debug("[DEBUG] History saved")
@@ -99,10 +103,12 @@ class ReadlineManager:
99
103
  def readline_input(self, prompt: str,
100
104
  default: str = "",
101
105
  required: bool = False,
102
- complete_with: Union[List[str], None] = None) -> str:
106
+ complete_with=None) -> str:
103
107
  """
104
108
  Prompt for input with optional readline autocompletion and command
105
109
  history saving.
110
+
111
+ :complete_with: A list of strings to complete with.
106
112
  """
107
113
  all_keywords = self.keywords | \
108
114
  set(complete_with if complete_with else {})
@@ -128,7 +134,7 @@ class ReadlineManager:
128
134
  break
129
135
  finally:
130
136
  if save_history and self.history_file:
131
- self._save_history()
137
+ self.save_history_file()
132
138
 
133
139
  return default if value == "" else value
134
140
  finally:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-commitflow
3
- Version: 1.1.1
3
+ Version: 1.1.3
4
4
  Summary: A git add/commit/push helper
5
5
  Home-page: https://github.com/jamescherti/git-commitflow
6
6
  Author: James Cherti
@@ -23,7 +23,7 @@ from setuptools import find_packages, setup
23
23
 
24
24
  setup(
25
25
  name="git-commitflow",
26
- version="1.1.1",
26
+ version="1.1.3",
27
27
  packages=find_packages(),
28
28
  description="A git add/commit/push helper",
29
29
  long_description=((Path(__file__).parent.resolve().joinpath("README.md"))
File without changes
File without changes
File without changes