Skip to content

Commit 6bb9391

Browse files
committed
feat(cmd[git]): Add Git.version
1 parent 0099900 commit 6bb9391

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

src/libvcs/cmd/git.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,3 +1648,31 @@ def config(
16481648
["config", *local_flags],
16491649
check_returncode=False,
16501650
)
1651+
1652+
def version(
1653+
self,
1654+
*,
1655+
build_options: Optional[bool] = None,
1656+
**kwargs: Any,
1657+
) -> str:
1658+
"""Version. Wraps `git version <https://git-scm.com/docs/git-version>`_.
1659+
1660+
Examples
1661+
--------
1662+
>>> git = Git(dir=git_local_clone.dir)
1663+
1664+
>>> git.version()
1665+
'git version ...'
1666+
1667+
>>> git.version(build_options=True)
1668+
'git version ...'
1669+
"""
1670+
local_flags: list[str] = []
1671+
1672+
if build_options is True:
1673+
local_flags.append("--build-options")
1674+
1675+
return self.run(
1676+
["version", *local_flags],
1677+
check_returncode=False,
1678+
)

0 commit comments

Comments
 (0)