feat(cli): add per-file commit generation option

This commit is contained in:
sankalp committed 2025-08-25 14:47:43 +05:45
1 parent 4ecf72c7cc
commit 3df312a7fb
4 files changed
+93 -7

No files matched your search

+17
View File
@@ -94,6 +94,23 @@ class GitService:
stdout, stderr, returncode = self._run_git_command(args)
return returncode == 0, stdout, stderr, returncode
def commit_paths_verbose(
self, message: str, files: List[str], sign: bool = False
) -> Tuple[bool, str, str, int]:
"""Create a commit including only the specified files.
Returns:
(ok, stdout, stderr, returncode)
"""
if not files:
return False, "", "no files specified", 1
args = ["commit"]
if sign:
args.append("-S")
args.extend(["-m", message, "--"] + list(files))
stdout, stderr, returncode = self._run_git_command(args)
return returncode == 0, stdout, stderr, returncode
def get_repo_name(self) -> str:
"""Get the repository name."""
stdout, _, _ = self._run_git_command(["rev-parse", "--show-toplevel"])