Skip to content

Eval python code #771

Open
Open
@tony

Description

@tony

In addition to our plugin system #530 #628

We can allow inserting of scripts into "commands"

pane.eval

windows:
  panes:
  - shell_command:
    - eval: >
      def run(pane):
          # total access up the tree
          window = pane.window
          session = pane.window.session
          server = pane.window.server.server

          pane.send_keys(f'echo "ran this by hand in {window.window_name} of {session.session_name} in {server}', enter=True)
    - cmd: echo "hello"

pane.eval_script

See also tmuxp run-script #772

script.sh:

def run(pane):
    # total access up the tree
    window = pane.window
    session = pane.window.session
    server = pane.window.server.server

    pane.send_keys(f'echo "ran this by hand in {window.window_name} of {session.session_name} in {server}', enter=True)
windows:
  panes:
  - shell_command:
    - eval_script: script.py
    - cmd: echo "hello"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions