tgit 0.5.0__tar.gz → 0.5.2__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.3
2
2
  Name: tgit
3
- Version: 0.5.0
3
+ Version: 0.5.2
4
4
  Summary: Tool for Git Interaction Temptation (tgit): An elegant CLI tool that simplifies and streamlines your Git workflow, making version control a breeze.
5
5
  Author-email: Jannchie <jannchie@gmail.com>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tgit"
3
- version = "0.5.0"
3
+ version = "0.5.2"
4
4
  description = "Tool for Git Interaction Temptation (tgit): An elegant CLI tool that simplifies and streamlines your Git workflow, making version control a breeze."
5
5
  authors = [{ name = "Jannchie", email = "jannchie@gmail.com" }]
6
6
  dependencies = [
@@ -7,6 +7,7 @@ from typing import Optional
7
7
  import git
8
8
  from openai import OpenAI
9
9
  from pydantic import BaseModel
10
+ from rich import print
10
11
 
11
12
  from tgit.settings import settings
12
13
  from tgit.utils import get_commit_command, run_command, type_emojis
@@ -23,7 +24,11 @@ def define_commit_parser(subparsers: argparse._SubParsersAction):
23
24
  commit_type.append(data.get("type"))
24
25
 
25
26
  parser_commit = subparsers.add_parser("commit", help="commit changes following the conventional commit format")
26
- parser_commit.add_argument("message", help="commit message", type=str, nargs="*")
27
+ parser_commit.add_argument(
28
+ "message",
29
+ help="commit message, the first word should be the type, if the message is more than two parts, the second part should be the scope",
30
+ nargs="*",
31
+ )
27
32
  parser_commit.add_argument("-v", "--verbose", action="count", default=0, help="increase output verbosity")
28
33
  parser_commit.add_argument("-e", "--emoji", action="store_true", help="use emojis")
29
34
  parser_commit.add_argument("-b", "--breaking", action="store_true", help="breaking change")
@@ -66,7 +71,7 @@ def get_ai_command():
66
71
  response_format=CommitData,
67
72
  )
68
73
  resp = chat_completion.choices[0].message.parsed
69
- return get_commit_command(resp.type, resp.scope, resp.msg, type_emojis.get(resp.type), resp.is_breaking)
74
+ return get_commit_command(resp.type, resp.scope, resp.msg, settings.get("commit", {}).get("emoji", False), resp.is_breaking)
70
75
 
71
76
 
72
77
  def handle_commit(args: CommitArgs):
@@ -79,6 +84,9 @@ def handle_commit(args: CommitArgs):
79
84
  command = get_ai_command()
80
85
  else:
81
86
  messages = args.message
87
+ if len(messages) == 0:
88
+ print("Please provide a commit message, or use --ai to generate by AI")
89
+ return
82
90
  commit_type = messages[0]
83
91
  if len(messages) > 2:
84
92
  commit_scope = messages[1]
@@ -36,7 +36,7 @@ def get_commit_command(commit_type: str, commit_scope: Optional[str], commit_msg
36
36
  if commit_scope is None:
37
37
  msg = f"{commit_type}{breaking_str}: {commit_msg}"
38
38
  else:
39
- msg = f"{commit_type}{breaking_str}({commit_scope}): {commit_msg}"
39
+ msg = f"{commit_type}({commit_scope}){breaking_str}: {commit_msg}"
40
40
  if use_emoji:
41
41
  msg = f"{type_emojis.get(commit_type, ':wrench:' )} {msg}"
42
42
  return f'git commit -m "{msg}"'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes