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

Support sleep_before, sleep_after #750

Merged
merged 12 commits into from Mar 14, 2022
Merged

Support sleep_before, sleep_after #750

merged 12 commits into from Mar 14, 2022

Conversation

tony
Copy link
Member

@tony tony commented Mar 13, 2022

Requires #751 is fixed

#748

Example: shell_command_before + sleep

Todo

Fix and test shell_command_before

``` Traceback (most recent call last): File "/home/t/work/python/tmuxp/.venv/bin/tmuxp", line 5, in cli.cli() File "python3.10/site-packages/click/core.py", line 1128, in __call__ return self.main(*args, **kwargs) File "python3.10/site-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "python3.10/site-packages/click/core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "python3.10/site-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) File "python3.10/site-packages/click/core.py", line 754, in invoke return __callback(*args, **kwargs) File "python3.10/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/home/t/work/python/tmuxp/tmuxp/cli.py", line 1132, in command_load load_workspace(config[-1], **tmux_options) File "/home/t/work/python/tmuxp/tmuxp/cli.py", line 656, in load_workspace sconfig = config.expand(sconfig, os.path.dirname(config_file)) File "/home/t/work/python/tmuxp/tmuxp/config.py", line 308, in expand session_config["shell_command_before"] = expand_cmd(shell_command_before) File "/home/t/work/python/tmuxp/tmuxp/config.py", line 200, in expand_cmd cmds[cmd_idx]["cmd"] = expandshell(cmds[cmd_idx]["cmd"]) KeyError: 'cmd' ```

Demo

session_name: 'glorp'
# Reference this issue for why we need to use `source` here:
# https://github.com/tmux-python/tmuxp/issues/412
shell_command_before:
- cmd: source $(poetry env info --path)/bin/activate
  sleep_before: 1
  sleep_after: 1
windows:
  - panes:
    - echo "hello"

You'd this this would be possible

session_name: 'glorp'
# Reference this issue for why we need to use `source` here:
# https://github.com/tmux-python/tmuxp/issues/412
windows:
  - panes:
    - shell_command:
      - cmd: source $(poetry env info --path)/bin/activate
        sleep_after: 1
      - echo "hello"

@tony tony mentioned this pull request Mar 13, 2022
@tony tony changed the title Shell commands: Allow passing options per cmd Command options Mar 13, 2022
@tony tony force-pushed the tn-pane-cmd-shell-cmd-before branch from e0f57f1 to 3a6830b Compare March 13, 2022 13:06
@tony tony changed the title Command options shell_command_before: Support sleep/enter/etc Mar 13, 2022
@tony tony force-pushed the tn-pane-cmd-shell-cmd-before branch from 3a6830b to f9beb9e Compare March 13, 2022 17:55
tony added a commit that referenced this pull request Mar 13, 2022
For those trying to get the timing of commands just right.
@tony tony force-pushed the tn-pane-cmd-shell-cmd-before branch from f9beb9e to 93dd35b Compare March 13, 2022 23:17
@tony tony changed the title shell_command_before: Support sleep/enter/etc Support sleep_before, sleep_after Mar 13, 2022
@codecov
Copy link

codecov bot commented Mar 13, 2022

Codecov Report

Merging #750 (89bfa9e) into master (5bfb779) will increase coverage by 0.01%.
The diff coverage is 77.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #750      +/-   ##
==========================================
+ Coverage   76.07%   76.08%   +0.01%     
==========================================
  Files           7        7              
  Lines        1187     1196       +9     
  Branches      312      314       +2     
==========================================
+ Hits          903      910       +7     
- Misses        197      198       +1     
- Partials       87       88       +1     
Impacted Files Coverage Δ
tmuxp/workspacebuilder.py 85.07% <77.77%> (-0.35%) ⬇️

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 5bfb779...89bfa9e. Read the comment docs.

@tony tony force-pushed the tn-pane-cmd-shell-cmd-before branch 3 times, most recently from 0e34dd5 to 29dd144 Compare March 14, 2022 00:09
@tony tony force-pushed the tn-pane-cmd-shell-cmd-before branch from 29dd144 to 05918f8 Compare March 14, 2022 00:12
@tony tony force-pushed the tn-pane-cmd-shell-cmd-before branch from c0cddf5 to e841edb Compare March 14, 2022 00:27
@tony tony merged commit 7c2437f into master Mar 14, 2022
This was referenced Mar 15, 2022
@tony tony deleted the tn-pane-cmd-shell-cmd-before branch June 11, 2022 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant