Skip to content

Commit fc44117

Browse files
committed
feat(cmd.git): Add git.help
1 parent b03f309 commit fc44117

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

libvcs/cmd/git.py

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,3 +1013,86 @@ def init(
10131013
return self.run(
10141014
["init", *local_flags, "--", *required_flags], check_returncode=False
10151015
)
1016+
1017+
def help(
1018+
self,
1019+
all: Optional[bool] = None,
1020+
verbose: Optional[bool] = None,
1021+
no_external_commands: Optional[bool] = None,
1022+
no_aliases: Optional[bool] = None,
1023+
config: Optional[str] = None,
1024+
guides: Optional[str] = None,
1025+
info: Optional[str] = None,
1026+
man: Optional[str] = None,
1027+
web: Optional[str] = None,
1028+
**kwargs,
1029+
):
1030+
"""Help info. Wraps `git help <https://git-scm.com/docs/git-help>`_.
1031+
1032+
Parameters
1033+
----------
1034+
all : bool
1035+
Prints everything.
1036+
1037+
no_external_commands : bool
1038+
For use with ``all``, excludes external commands.
1039+
1040+
no_aliases : bool
1041+
For use with ``all``, excludes aliases.
1042+
1043+
verbose : bool
1044+
For us with ``all``, on by default.
1045+
1046+
config : bool
1047+
List all config vars.
1048+
1049+
guides : bool
1050+
List concept guides.
1051+
1052+
info : bool
1053+
Display man page in info format.
1054+
1055+
man : bool
1056+
Man page.
1057+
1058+
web : bool
1059+
Man page in HTML.
1060+
1061+
Examples
1062+
--------
1063+
>>> git = Git(dir=tmp_path)
1064+
1065+
>>> git.help()
1066+
"usage: git [--version] [--help] [-C <path>]..."
1067+
1068+
>>> git.help(all=True)
1069+
"See 'git help <command>' to read about a specific subcommand..."
1070+
1071+
>>> git.help(info=True)
1072+
"usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]..."
1073+
1074+
>>> git.help(man=True)
1075+
"usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]..."
1076+
"""
1077+
local_flags: list[str] = []
1078+
1079+
if verbose is True:
1080+
local_flags.append("--verbose")
1081+
if all is True:
1082+
local_flags.append("--all")
1083+
if no_external_commands is True:
1084+
local_flags.append("--no-external-commands")
1085+
if no_aliases is True:
1086+
local_flags.append("--no-aliases")
1087+
if config is True:
1088+
local_flags.append("--config")
1089+
if guides is True:
1090+
local_flags.append("--guides")
1091+
if info is True:
1092+
local_flags.append("--info")
1093+
if man is True:
1094+
local_flags.append("--man")
1095+
if web is True:
1096+
local_flags.append("--web")
1097+
1098+
return self.run(["help", *local_flags], check_returncode=False)

0 commit comments

Comments
 (0)