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

Split init / exec of tmux_cmd for debuggability #79

Open
wants to merge 2 commits into
base: master
from
Open

Conversation

@tony
Copy link
Member

@tony tony commented Nov 10, 2017

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 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 codecov-io commented Nov 10, 2017

Codecov Report

Merging #79 into master will decrease coverage by 0.06%.
The diff coverage is 85.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #79      +/-   ##
==========================================
- Coverage   87.06%   86.99%   -0.07%     
==========================================
  Files          16       16              
  Lines        1538     1561      +23     
==========================================
+ Hits         1339     1358      +19     
- Misses        199      203       +4     
Impacted Files Coverage Δ
tests/test_common.py 97.01% <80.00%> (-2.99%) ⬇️
libtmux/common.py 86.76% <100.00%> (+0.33%) ⬆️
libtmux/server.py 79.42% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 83eeb9d...96387d9. Read the comment docs.

@tony tony force-pushed the master branch from d8613b9 to 60d8dd9 Apr 7, 2018
@tony tony force-pushed the master branch from e7720bc to 776245b Jun 23, 2018
@tony tony force-pushed the tmux-cmd-execute branch 2 times, most recently from 509689c to 7347d87 Aug 16, 2020
@tony tony force-pushed the master branch from 0a29f07 to 16d51b3 Aug 16, 2020
@tony tony force-pushed the tmux-cmd-execute branch 5 times, most recently from b6cb85c to 5facc9c Oct 24, 2020
tony added 2 commits Nov 10, 2017
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 5facc9c to 96387d9 Oct 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.