Skip to content

Commit 72b9a75

Browse files
committed
options(feat[show_options]): Add public show_options() method
why: CHANGES documented Window.show_options() as replacement for show_window_options(), but only private _show_options() existed. what: - Add show_options() public method to OptionsMixin as thin wrapper - Add doctest examples for show_options()
1 parent ec4752f commit 72b9a75

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

src/libtmux/options.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,52 @@ def _show_options(
939939

940940
return t.cast("ExplodedComplexUntypedOptionsDict", output_exploded)
941941

942+
def show_options(
943+
self,
944+
global_: bool = False,
945+
scope: OptionScope | _DefaultOptionScope | None = DEFAULT_OPTION_SCOPE,
946+
include_hooks: bool | None = None,
947+
include_inherited: bool | None = None,
948+
) -> ExplodedComplexUntypedOptionsDict:
949+
"""Return all options for the target.
950+
951+
Parameters
952+
----------
953+
global_ : bool, optional
954+
Pass ``-g`` flag for global options, default False.
955+
scope : OptionScope | _DefaultOptionScope | None, optional
956+
Option scope (Server/Session/Window/Pane), defaults to object's scope.
957+
include_hooks : bool, optional
958+
Include hook options (``-H`` flag).
959+
include_inherited : bool, optional
960+
Include inherited options (``-A`` flag).
961+
962+
Returns
963+
-------
964+
ExplodedComplexUntypedOptionsDict
965+
Dictionary with all options, arrays exploded and values converted.
966+
967+
Raises
968+
------
969+
:exc:`exc.OptionError`, :exc:`exc.UnknownOption`,
970+
:exc:`exc.InvalidOption`, :exc:`exc.AmbiguousOption`
971+
972+
Examples
973+
--------
974+
>>> options = server.show_options()
975+
>>> isinstance(options, dict)
976+
True
977+
978+
>>> 'buffer-limit' in options
979+
True
980+
"""
981+
return self._show_options(
982+
global_=global_,
983+
scope=scope,
984+
include_hooks=include_hooks,
985+
include_inherited=include_inherited,
986+
)
987+
942988
def _show_option_raw(
943989
self,
944990
option: str,

0 commit comments

Comments
 (0)