Skip to content

pyparam.help

module

pyparam.help

Help assembler for pyparam

Attributes
  • THEMES (dict(str: Theme)) The theme for the help page.
Classes
class

pyparam.help.ProgHighlighter(prog)

Bases
rich.highlighter.RegexHighlighter rich.highlighter.Highlighter

Apply style to anything that looks like a program name.

Parameters
  • prog (str) The program name
Methods
  • __call__(text) (Text) Highlight a str or Text instance.</>
  • highlight(text) Highlight :class:rich.text.Text using regular expressions.</>
method

__call__(text)

Highlight a str or Text instance.

Parameters
  • text (Union[str, ~Text]) Text to highlight.
Raises
  • TypeError If not called with text or str.
Returns (Text)

A test instance with highlighting applied.

method

highlight(text)

Highlight :class:rich.text.Text using regular expressions.

Parameters
  • text (~Text) Text to highlighted.
class

pyparam.help.OptnameHighlighter()

Bases
rich.highlighter.RegexHighlighter rich.highlighter.Highlighter

Apply style to anything that looks like a option name.

Highlight -b and --box in -b, --box <INT>, and all in commands: i, install

Methods
  • __call__(text) (Text) Highlight a str or Text instance.</>
  • highlight(text) Highlight :class:rich.text.Text using regular expressions.</>
method

__call__(text)

Highlight a str or Text instance.

Parameters
  • text (Union[str, ~Text]) Text to highlight.
Raises
  • TypeError If not called with text or str.
Returns (Text)

A test instance with highlighting applied.

method

highlight(text)

Highlight :class:rich.text.Text using regular expressions.

Parameters
  • text (~Text) Text to highlighted.
class

pyparam.help.OpttypeHighlighter()

Bases
rich.highlighter.RegexHighlighter rich.highlighter.Highlighter

Apply style to anything that looks like a option type.

Methods
  • __call__(text) (Text) Highlight a str or Text instance.</>
  • highlight(text) Highlight :class:rich.text.Text using regular expressions.</>
method

__call__(text)

Highlight a str or Text instance.

Parameters
  • text (Union[str, ~Text]) Text to highlight.
Raises
  • TypeError If not called with text or str.
Returns (Text)

A test instance with highlighting applied.

method

highlight(text)

Highlight :class:rich.text.Text using regular expressions.

Parameters
  • text (~Text) Text to highlighted.
class

pyparam.help.DefaultHighlighter()

Bases
rich.highlighter.RegexHighlighter rich.highlighter.Highlighter

Apply style to anything that looks like default value in option desc.

Methods
  • __call__(text) (Text) Highlight a str or Text instance.</>
  • highlight(text) Highlight :class:rich.text.Text using regular expressions.</>
method

__call__(text)

Highlight a str or Text instance.

Parameters
  • text (Union[str, ~Text]) Text to highlight.
Raises
  • TypeError If not called with text or str.
Returns (Text)

A test instance with highlighting applied.

method

highlight(text)

Highlight :class:rich.text.Text using regular expressions.

Parameters
  • text (~Text) Text to highlighted.
class

pyparam.help.HelpSection(iterable=())

Bases
list

Base class for all help sections.

Methods
  • __rich_console__(console, _) (ConsoleRenderable, RichCast, str, or Segment) Implement API from rich to print the help page</>
generator

__rich_console__(console, _) → ConsoleRenderable, RichCast, str, or Segment

Implement API from rich to print the help page

class

pyparam.help.HelpSectionPlain(iterable=())

Plain text section

Methods
  • __rich_console__(console, _) (ConsoleRenderable, RichCast, str, or Segment) Implement API from rich to print the help page</>
generator

__rich_console__(console, _) → ConsoleRenderable, RichCast, str, or Segment

Implement API from rich to print the help page

class

pyparam.help.HelpSectionUsage(iterable=())

Usage section in help

Methods
  • __rich_console__(console, _) (ConsoleRenderable, RichCast, str, or Segment) Implement API from rich to print the help page</>
generator

__rich_console__(console, _) → ConsoleRenderable, RichCast, str, or Segment

Implement API from rich to print the help page

class

pyparam.help.HelpSectionOption(iterable=())

Options section in help

Methods
  • __rich_console__(console, _) (ConsoleRenderable, RichCast, str, or Segment) Implement API from rich to print the help page</>
generator

__rich_console__(console, _) → ConsoleRenderable, RichCast, str, or Segment

Implement API from rich to print the help page

class

pyparam.help.HelpAssembler(prog, theme, callback)

Assemble a help page

Parameters
  • prog (str) The name of the program
  • theme (str or Theme) The theme for the help page
Attributes
  • callback (callable) The callback to modify the help page
  • console (Console) The console to print the help page
Methods
method

assemble(params, full=False)

Assemble the help page

Parameters
  • params (Params) The params object
method

printout()

Print the help page