git-commitflow 1.1.0__tar.gz → 1.1.1__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
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: git-commitflow
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Summary: A git add/commit/push helper
5
5
  Home-page: https://github.com/jamescherti/git-commitflow
6
6
  Author: James Cherti
@@ -27,6 +27,7 @@ Dynamic: classifier
27
27
  Dynamic: description
28
28
  Dynamic: description-content-type
29
29
  Dynamic: home-page
30
+ Dynamic: license-file
30
31
  Dynamic: requires-dist
31
32
  Dynamic: requires-python
32
33
  Dynamic: summary
@@ -29,28 +29,29 @@ import colorama
29
29
  from .git_commitflow import GitCommitFlow
30
30
 
31
31
 
32
- def git_commitflow_cli():
33
- """The git-commitflow command-line interface."""
34
- logging.basicConfig(level=logging.INFO, stream=sys.stdout,
35
- format="%(asctime)s %(name)s: %(message)s")
36
- colorama.init()
32
+ def flush_stdin():
33
+ """Clear any pending input from the standard input buffer.
37
34
 
35
+ This function ensures that no stale or unintended data remains in stdin
36
+ before reading user input interactively. On Windows, it uses the msvcrt
37
+ module to discard characters from the input buffer. On POSIX-compliant
38
+ systems (e.g., Linux, macOS...), it uses select to check for available
39
+ input without blocking and either discards the data by reading or flushes
40
+ it using termios.tcflush if stdin is a terminal.
41
+ """
38
42
  try:
39
- import platform # pylint: disable=import-outside-toplevel
40
43
  if os.name == "nt":
41
44
  import msvcrt # pylint: disable=import-outside-toplevel
42
45
 
43
- # Check if there's input in the buffer
46
+ # For Windows systems, Check if there is any pending input in the
47
+ # buffer Discard characters one at a time until the buffer is empty
44
48
  while msvcrt.kbhit():
45
- # Read and discard one character at a time
46
49
  msvcrt.getch()
47
- elif os.name == "posix" or platform.system() in ["Linux", "Darwin"]:
48
- # For Unix-like systems, check if there's any pending input in
49
- # stdin without blocking
50
+ elif os.name == "posix":
50
51
  import select # pylint: disable=import-outside-toplevel
51
52
 
52
- # Check if there is any pending input in stdin without blocking
53
- # If input is available, flush the stdin buffer
53
+ # For Unix-like systems, check if there's any pending input in
54
+ # stdin without blocking
54
55
  stdin, _, _ = select.select([sys.stdin], [], [], 0)
55
56
  if stdin:
56
57
  if sys.stdin.isatty():
@@ -61,10 +62,20 @@ def git_commitflow_cli():
61
62
  tcflush(sys.stdin.fileno(), TCIFLUSH)
62
63
  else:
63
64
  # Read and discard input (in chunks)
64
- sys.stdin.read(1024)
65
+ while sys.stdin.read(1024):
66
+ pass
65
67
  except ImportError:
66
68
  pass
67
69
 
70
+
71
+ def git_commitflow_cli():
72
+ """The git-commitflow command-line interface."""
73
+ logging.basicConfig(level=logging.INFO, stream=sys.stdout,
74
+ format="%(asctime)s %(name)s: %(message)s")
75
+ colorama.init()
76
+
77
+ flush_stdin()
78
+
68
79
  try:
69
80
  GitCommitFlow().main()
70
81
  except subprocess.CalledProcessError as main_proc_err:
@@ -372,22 +372,23 @@ 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="")
375
+ # print("Git message: ", end="")
376
376
 
377
- commit_message = self.git_config_get("custom.commit-message").strip()
378
- previous_message = ""
379
- if commit_message:
380
- 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)
377
+ # commit_message = self.git_config_get("custom.commit-message").strip()
378
+ # previous_message = ""
379
+ # if commit_message:
380
+ # 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)
386
386
 
387
- commit_message = self.prompt_git_commit_message(commit_message)
387
+ # commit_message = self.prompt_git_commit_message(commit_message)
388
+ commit_message = self.prompt_git_commit_message("")
388
389
 
389
390
  # TODO: move this to a function
390
- logging.debug("[DEBUG] Previous message: %s", previous_message)
391
+ # logging.debug("[DEBUG] Previous message: %s", previous_message)
391
392
  logging.debug("[DEBUG] Commit message: %s", commit_message)
392
393
 
393
394
  return commit_message
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: git-commitflow
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Summary: A git add/commit/push helper
5
5
  Home-page: https://github.com/jamescherti/git-commitflow
6
6
  Author: James Cherti
@@ -27,6 +27,7 @@ Dynamic: classifier
27
27
  Dynamic: description
28
28
  Dynamic: description-content-type
29
29
  Dynamic: home-page
30
+ Dynamic: license-file
30
31
  Dynamic: requires-dist
31
32
  Dynamic: requires-python
32
33
  Dynamic: summary
@@ -23,7 +23,7 @@ from setuptools import find_packages, setup
23
23
 
24
24
  setup(
25
25
  name="git-commitflow",
26
- version="1.1.0",
26
+ version="1.1.1",
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