Skip to content

Commit

Permalink
Revert "Revert "!squash more window show_option""
Browse files Browse the repository at this point in the history
This reverts commit 5a100f5.
  • Loading branch information
tony committed Feb 6, 2024
1 parent 8c6a49e commit 2fdf6e8
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 additions & 1 deletion src/libtmux/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,47 @@ def show_window_options(self, g: t.Optional[bool] = False) -> "WindowOptionDict"
option_type=OptionType.Window,
)

@t.overload
def show_options(
self,
g: t.Optional[bool] = False,
g: t.Optional[bool],
option_type: t.Optional[OptionType],
include_hooks: t.Optional[bool],
include_parents: t.Optional[bool],
values_only: t.Literal[True],
) -> t.List[str]:
...

@t.overload
def show_options(
self,
g: t.Optional[bool],
option_type: t.Optional[OptionType],
include_hooks: t.Optional[bool],
include_parents: t.Optional[bool],
values_only: t.Literal[None] = None,
) -> "WindowOptionDict":
...

@t.overload
def show_options(
self,
g: t.Optional[bool] = None,
option_type: t.Optional[OptionType] = None,
include_hooks: t.Optional[bool] = None,
include_parents: t.Optional[bool] = None,
values_only: t.Literal[False] = False,
) -> "WindowOptionDict":
...

def show_options(
self,
g: t.Optional[bool] = False,
option_type: t.Optional[OptionType] = None,
include_hooks: t.Optional[bool] = None,
include_parents: t.Optional[bool] = None,
values_only: t.Optional[bool] = False,
) -> t.Union["WindowOptionDict", t.List[str]]:
"""Return a dict of options for the window.
For familiarity with tmux, the option ``option`` param forwards to pick a
Expand All @@ -469,6 +505,15 @@ def show_options(
assert option_type in OPTION_TYPE_FLAG_MAP
tmux_args += (OPTION_TYPE_FLAG_MAP[option_type],)

if include_parents is not None and include_parents:
tmux_args += ("-A",)

if include_hooks is not None and include_hooks:
tmux_args += ("-H",)

if values_only is not None and values_only:
tmux_args += ("-v",)

cmd = self.cmd("show-options", *tmux_args)

output = cmd.stdout
Expand Down

0 comments on commit 2fdf6e8

Please sign in to comment.