Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved option management, add hook management #516

Open
wants to merge 39 commits into
base: master
Choose a base branch
from

Conversation

tony
Copy link
Member

@tony tony commented Feb 7, 2024

Extracted from #513

Warning

APIs below are subject to change (both params, return types, and structures)

Changes

New internal: OptionsMixin

  • show_options(): High level objects, e.g. preserving sparse-array data such as command-alias[1], command-alias[99], and inside of a dataclass object.

    command_alias: TmuxArray({0: {'split-pane': 'split-window'})

  • _show_options(): Map of options split up by key, with raw values.

    command-alias[1] split-pane=split-window

  • _show_options_raw(): Raw stdout from tmux show-options

Individual options:

  • show_option(): High level objects, e.g. preserving sparse-array data such as command-alias[1], command-alias[99]

    Not sure if this will scale, but will try to get this:

    > show_option('command-alias')
    TmuxArray({0: 'split-pane': 'split-window'})
    
    > show_option('command-alias')[0]
    'split-pane': 'split-window'
    
    > show_option('command-alias[0]')
    'split-pane': 'split-window'
    
  • _show_option():

  • _show_option_raw(): Raw stdout from tmux show-option [option name]

New internal: HooksMixin

New features

  • Window.set_option()

    Learned params:

    • format -> -F
    • unset -> -u
    • global -> -g
    • unset_panes -> -U: Also unset other panse in windows
    • prevent_overwrite: -o
    • suppress_warnings: -q
    • append: -a
  • Window.show_option()

  • Window.show_options()

Breaking changes

Deprecations

  • Deprecated Window.set_window_option() in favor of Window.set_option()
  • Deprecated Window.show_window_option() in favor of Window.show_option()
  • Deprecated Window.show_window_options() in favor of Window.show_options()

Copy link

codecov bot commented Feb 7, 2024

Codecov Report

Attention: Patch coverage is 84.11978% with 175 lines in your changes are missing coverage. Please review.

Project coverage is 87.65%. Comparing base (c516dd6) to head (d67070d).

Files Patch % Lines
src/libtmux/hooks.py 41.72% 61 Missing and 20 partials ⚠️
src/libtmux/options.py 72.38% 47 Missing and 27 partials ⚠️
src/libtmux/_internal/constants.py 96.61% 7 Missing and 2 partials ⚠️
tests/test_options.py 95.72% 1 Missing and 7 partials ⚠️
src/libtmux/common.py 80.00% 1 Missing ⚠️
tests/legacy_api/test_window.py 95.65% 0 Missing and 1 partial ⚠️
tests/test_window.py 97.29% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #516      +/-   ##
==========================================
- Coverage   88.54%   87.65%   -0.89%     
==========================================
  Files          36       41       +5     
  Lines        3927     4878     +951     
  Branches      570      720     +150     
==========================================
+ Hits         3477     4276     +799     
- Misses        308      414     +106     
- Partials      142      188      +46     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tony tony mentioned this pull request Feb 7, 2024
@tony tony force-pushed the improved-options branch 4 times, most recently from e5c6186 to 37898a4 Compare February 8, 2024 12:35
@tony tony mentioned this pull request Feb 8, 2024
@tony tony force-pushed the improved-options branch 22 times, most recently from 97d74c1 to 36c5907 Compare February 8, 2024 18:54
tony added 29 commits May 11, 2024 06:16
…evel, "sparse array" objects and for those to set"

This reverts commit 6e9d195.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant