remi / teamocil

There's no I in Teamocil. At least not where you think. Teamocil is a simple tool used to automatically create windows and panes in tmux with YAML files.
MIT License
2.36k stars 101 forks source link

Ability to set environment variables #127

Open trombonehero opened 6 years ago

trombonehero commented 6 years ago

I have a Teamocil YAML file that contains a lot of snippets like:

windows:
  - name: ...
    root: ...
    panes:
      - commands:
        - export CC=...
        - export CXX=...
        - export BUILD_ROOT=something/Debug
        - export PATH=...:something/Debug/bin
      - commands:
        - export CC=...
        - export CXX=...
        - export BUILD_ROOT=something/Release
        - export PATH=...:something/Release/bin
      - ...

This is fine when using sh(1) or compatible shells (bash, zsh...), but breaks with other shells (csh, fish) that prefer setenv or set --export. If Teamocil were to afford the ability to manipulate the environment via Ruby's ENV hash, I'd be able to write descriptions such as the following that work with different sorts of shells:

windows:
  - name: ...
    root: ...
    env:
      CC: ...      # would apply to all panes in this window
      CXX: ..      # would apply to all panes in this window
    panes:
      - env:       # only need to specify vars specific to this pane:
          BUILD_ROOT: ...:something/Debug
          PATH: ...:something/Debug/bin
      - env:
          BUILD_ROOT: ...:something/Release
          PATH: ...:something/Release/bin