Skip to content

Commit cbf78d4

Browse files
committed
before_script: with ./ at the beginning will load relative to tmuxp
file (project root). same behavior as start_directory. Some comments on how .expand()'s cwd argument is the project's config file dir when loading via cli.
1 parent 28fb282 commit cbf78d4

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

tmuxp/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ def load_workspace(config_file, args):
256256

257257
sconfig = kaptan.Kaptan()
258258
sconfig = sconfig.import_config(config_file).get()
259+
# expands configurations relative to config / profile file location
259260
sconfig = config.expand(sconfig, os.path.dirname(config_file))
260261
sconfig = config.trickle(sconfig)
261262

tmuxp/config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ def expand(sconf, cwd=None):
164164
165165
"""
166166

167+
# Note: cli.py will expand configs relative to project's config directory
168+
# for the first cwd argument.
167169
if not cwd:
168170
cwd = os.getcwd()
169171

@@ -175,6 +177,12 @@ def expand(sconf, cwd=None):
175177
start_path = os.path.normpath(os.path.join(cwd, start_path))
176178
sconf['start_directory'] = start_path
177179

180+
if 'before_script' in sconf:
181+
before_script = sconf['before_script']
182+
if any(before_script.startswith(a) for a in ['.', './']):
183+
before_script = os.path.normpath(os.path.join(cwd, before_script))
184+
sconf['before_script'] = before_script
185+
178186
if (
179187
'shell_command' in sconf and
180188
isinstance(sconf['shell_command'], string_types)

0 commit comments

Comments
 (0)