@@ -94,6 +94,7 @@ def strip_style(text: str) -> str:
9494def style_aware_wcswidth (text : str ) -> int :
9595 """
9696 Wrap wcswidth to make it compatible with strings that contains ANSI style sequences
97+
9798 :param text: the string being measured
9899 :return: the width of the string when printed to the terminal
99100 """
@@ -104,6 +105,7 @@ def style_aware_wcswidth(text: str) -> int:
104105def style_aware_write (fileobj : IO , msg : str ) -> None :
105106 """
106107 Write a string to a fileobject and strip its ANSI style sequences if required by allow_style setting
108+
107109 :param fileobj: the file object being written to
108110 :param msg: the string being written
109111 """
@@ -116,6 +118,7 @@ def style_aware_write(fileobj: IO, msg: str) -> None:
116118def fg_lookup (fg_name : str ) -> str :
117119 """
118120 Look up ANSI escape codes based on foreground color name.
121+
119122 :param fg_name: foreground color name to look up ANSI escape code(s) for
120123 :return: ANSI escape code(s) associated with this color
121124 :raises ValueError: if the color cannot be found
@@ -130,6 +133,7 @@ def fg_lookup(fg_name: str) -> str:
130133def bg_lookup (bg_name : str ) -> str :
131134 """
132135 Look up ANSI escape codes based on background color name.
136+
133137 :param bg_name: background color name to look up ANSI escape code(s) for
134138 :return: ANSI escape code(s) associated with this color
135139 :raises ValueError: if the color cannot be found
@@ -194,13 +198,13 @@ def style(text: Any, *, fg: str = '', bg: str = '', bold: bool = False,
194198# These can be altered to suit an application's needs and only need to be a
195199# function with the following structure: func(str) -> str
196200style_success = functools .partial (style , fg = 'green' )
197- """Partial function supplying arguments to style() to generate bold green text"""
201+ """Partial function supplying arguments to :meth:`cmd2.ansi. style()` to generate bold green text"""
198202
199203style_warning = functools .partial (style , fg = 'bright_yellow' )
200- """Partial function supplying arguments to ansi.style() to generate yellow text"""
204+ """Partial function supplying arguments to :meth:`cmd2. ansi.style()` to generate yellow text"""
201205
202206style_error = functools .partial (style , fg = 'bright_red' )
203- """Partial function supplying arguments to ansi.style() to generate bright red text"""
207+ """Partial function supplying arguments to :meth:`cmd2. ansi.style()` to generate bright red text"""
204208
205209
206210def async_alert_str (* , terminal_columns : int , prompt : str , line : str , cursor_offset : int , alert_msg : str ) -> str :
0 commit comments