Skip to content

Split init / exec of tmux_cmd for debuggability #79

New issue

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

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

Already on GitHub? # to your account

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

Conversation

tony
Copy link
Member

@tony tony commented Nov 10, 2017

Edit 2022-08-14 by @tony : This is very similar to SubprocessCommand (source)

tmux_cmd initialization composes the command

the command will be available in the instance attribute .cmd

.execute() instance method will run tmux_cmd

See Server.cmd for example of new usage

Related #77

@tony
Copy link
Member Author

tony commented Nov 10, 2017

This, as of c9598fb doesn't touch any of the Server/Session/Window/Pane .cmd method API's.

As a second part of this, I may add more things to split introspection of commands.

For instance:

  • Renaming tmux_cmd to TmuxCommand

  • Documenting how they are composed and can be configured, and why/how it's differs from standard library subprocess

  • Methods in Tmux objects, e.g. attach_session() may have a way to return the pure TmuxCommand object (and therefore preview the command generated, including the valuable target information (-t))

  • as a way the above could be implemented, it may be via adding methods like _attach_session() that return TmuxCommand and having attach_session wrap them and keep normal behavior

  • Another thing to consider is to break api's by requiring .execute() be ran to execute commands, and return TmuxCommand by default

  • BUT, allow for chaining commands. e.g., session.attached_window.set_window_option('main-pane-height', 50).select_layout('main-horizontal').execute(), this would give the equivalent to chaining commands with semicolons. This could substantially speed things up by allowing for composability with commands.

@codecov-io
Copy link

codecov-io commented Nov 10, 2017

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (02fe5d6) 88.13% compared to head (8e00da8) 88.04%.
Report is 929 commits behind head on master.

Files Patch % Lines
tests/test_common.py 80.95% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #79      +/-   ##
==========================================
- Coverage   88.13%   88.04%   -0.09%     
==========================================
  Files          15       15              
  Lines        1500     1523      +23     
==========================================
+ Hits         1322     1341      +19     
- Misses        178      182       +4     

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

tony added 2 commits April 9, 2022 11:38
tmux_cmd initialization composes the command

the command will be available in the instance attribute
.cmd

.execute() instance method will run tmux_cmd

see Server.cmd for example of new usage

Related #77
@tony tony force-pushed the tmux-cmd-execute branch from 1c8f8ef to 8e00da8 Compare April 9, 2022 16:39
@tony tony force-pushed the master branch 2 times, most recently from bb68b70 to d6ab13b Compare July 14, 2022 10:33
@tony
Copy link
Member Author

tony commented Aug 14, 2022

This is very similar to SubprocessCommand (source)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants