tgit 0.2.2__tar.gz → 0.3.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.1
2
2
  Name: tgit
3
- Version: 0.2.2
3
+ Version: 0.3.0
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
  Maintainer-email: Jannchie <jannchie@gmail.com>
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "tgit"
9
- version = "0.2.2"
9
+ version = "0.3.0"
10
10
  description = "Tool for Git Interaction Temptation (tgit): An elegant CLI tool that simplifies and streamlines your Git workflow, making version control a breeze."
11
11
  requires-python = ">=3.6"
12
12
  keywords = ["git", "tool", "changelog", "version", "commit"]
@@ -27,3 +27,4 @@ classifiers = [
27
27
 
28
28
  [project.scripts]
29
29
  tgit = "tgit.cli:main"
30
+ gitt = "tgit.cli:main"
@@ -5,22 +5,21 @@ from typing import Optional
5
5
  from tgit.settings import settings
6
6
  from tgit.utils import get_commit_command, run_command, type_emojis
7
7
 
8
+ commit_type = ["feat", "fix", "chore", "docs", "style", "refactor", "perf"]
9
+
8
10
 
9
11
  def define_commit_parser(subparsers):
10
12
  commit_type = ["feat", "fix", "chore", "docs", "style", "refactor", "perf"]
11
- prefix = ["!", ""]
12
13
  commit_settings = settings.get("commit", {})
13
14
  types_settings = commit_settings.get("types", [])
14
15
  for data in types_settings:
15
16
  type_emojis[data.get("type")] = data.get("emoji")
16
17
  commit_type.append(data.get("type"))
17
18
 
18
- choices = ["".join(data) for data in itertools.product(commit_type, prefix)] + ["ci", "test", "version"]
19
19
  parser_commit = subparsers.add_parser("commit", help="commit changes following the conventional commit format")
20
20
  parser_commit.add_argument(
21
21
  "type",
22
22
  help="commit type",
23
- choices=choices,
24
23
  )
25
24
  parser_commit.add_argument("scope", help="commit scope", type=str, nargs="?")
26
25
  parser_commit.add_argument("message", help="commit message", type=str)
@@ -41,6 +40,14 @@ class CommitArgs:
41
40
 
42
41
  def handle_commit(args: CommitArgs):
43
42
 
43
+ global commit_type
44
+ prefix = ["", "!"]
45
+ choices = ["".join(data) for data in itertools.product(commit_type, prefix)] + ["ci", "test", "version"]
46
+ if args.type not in choices:
47
+ print(f"Invalid type: {args.type}")
48
+ print(f"Valid types: {choices}")
49
+ return
50
+
44
51
  commit_type = args.type
45
52
  commit_scope = args.scope
46
53
  commit_msg = args.message
@@ -105,6 +105,7 @@ def get_prev_version():
105
105
  with open("VERSION") as f:
106
106
  version = f.read().strip()
107
107
  return Version.from_str(version)
108
+
108
109
  elif os.path.exists("VERSION.txt"):
109
110
  with open("VERSION.txt") as f:
110
111
  version = f.read().strip()
@@ -186,6 +187,8 @@ def handle_version(args: VersionArgs):
186
187
  )
187
188
  ]
188
189
  )
190
+ if not ans:
191
+ return
189
192
  release = ans["identifier"]
190
193
  next_version.release = release
191
194
  if target.bump == "custom":
@@ -275,6 +278,36 @@ def handle_version(args: VersionArgs):
275
278
  with open("pyproject.toml", "w") as f:
276
279
  f.write(new_pyproject_toml)
277
280
 
281
+ if os.path.exists("setup.py"):
282
+ if verbose > 0:
283
+ console.print("Updating setup.py")
284
+ with open("setup.py", "r") as f:
285
+ setup_py = f.read()
286
+ new_setup_py = re.sub(r"version=['\"].*?['\"]", f"version='{next_version_str}'", setup_py)
287
+ with open("setup.py", "w") as f:
288
+ f.write(new_setup_py)
289
+
290
+ if os.path.exists("Cargo.toml"):
291
+ if verbose > 0:
292
+ console.print("Updating Cargo.toml")
293
+ with open("Cargo.toml", "r") as f:
294
+ cargo_toml = f.read()
295
+ new_cargo_toml = re.sub(r"version\s*=\s*\".*?\"", f'version = "{next_version_str}"', cargo_toml)
296
+ with open("Cargo.toml", "w") as f:
297
+ f.write(new_cargo_toml)
298
+
299
+ if os.path.exists("VERSION"):
300
+ if verbose > 0:
301
+ console.print("Updating VERSION")
302
+ with open("VERSION", "w") as f:
303
+ f.write(next_version_str)
304
+
305
+ if os.path.exists("VERSION.txt"):
306
+ if verbose > 0:
307
+ console.print("Updating VERSION.txt")
308
+ with open("VERSION.txt", "w") as f:
309
+ f.write(next_version_str)
310
+
278
311
  git_tag = f"v{next_version_str}"
279
312
 
280
313
  commands = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tgit
3
- Version: 0.2.2
3
+ Version: 0.3.0
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
  Maintainer-email: Jannchie <jannchie@gmail.com>
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
+ gitt = tgit.cli:main
2
3
  tgit = tgit.cli:main
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