API Reference#

This page shows the Python API for GitHelp, generated from docstrings.

githelp.ollama.ask_ollama(git_output, mode='explain')#

Ask an ollama model to explain captured git output.

Parameters:
  • git_output – The stdout text from a git command (ex git status).

  • model – Controls what kind of explanation is requested. Use explain (the default) for a longer beginner-friendly explanation, or save for a very short phrase suitable for inline display in the githelp save command.

Returns:

Explanation text from ollama, or an error message if something fails.

Return type:

str

githelp.overlays.read_yaml(path)#

Read a YAML file into a Python object.

Parameters:

path – Path to the YAML file to read.

Returns:

Parsed YAML contents. Returns an empty dict if the file is empty or if any error occurs while reading/parsing.

Return type:

dict

githelp.overlays.load_overlay(command)#

Get the tips for one git subcommand.

This first looks in the TIPS file tips.yml under the given command name (ex pull). If found, it returns the corresponding dictionary of tips.

Parameters:

command – Name of the git subcommand

Returns:

The overlay dictionary for the given command, with a "command" key ensured, or None if no tip is defined.

Return type:

dict or None

githelp.overlays.render_overlay(dict)#

Render a single overlay dictionary into a human readable text block.

Parameters:

dict – Overlay dictionary containing keys such as "summary", It has "when_to_use", and "examples".

Returns:

Using fstring to format the text block for display.

Return type:

str

githelp.cli.githelp_cli(*args: t.Any, **kwargs: t.Any) t.Any#
githelp.cli.explain_cmd(*args: t.Any, **kwargs: t.Any) t.Any#

Explain a git subcommand

  • Tries to use ollama (default model - llama2) to explain git command.

  • If ollama is not installed or returns an error, falls back to tips.yml.

githelp.cli.tips_cmd(*args: t.Any, **kwargs: t.Any) t.Any#

Show tips.yml content for a specific git subcommand.

Examples

  • githelp tips add

  • githelp tips status

  • githelp tips branch