Skip to content

Commit ca79acb

Browse files
committed
Added support for -f flag to use non-default tmux config file
1 parent f4aa2e2 commit ca79acb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tmuxp/cli.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ def load_workspace(
395395
config_file,
396396
socket_name=None,
397397
socket_path=None,
398+
tmux_config_file=None,
398399
colors=None,
399400
detached=False,
400401
answer_yes=False,
@@ -410,6 +411,8 @@ def load_workspace(
410411
``tmux -L <socket-name>``
411412
socket_path: str, optional
412413
``tmux -S <socket-path>``
414+
tmux_config_file: str, optional
415+
``tmux -f <config-file>``
413416
colors : str, optional
414417
'-2'
415418
Force tmux to support 256 colors
@@ -498,7 +501,10 @@ def load_workspace(
498501
sconfig = config.trickle(sconfig)
499502

500503
t = Server( # create tmux server object
501-
socket_name=socket_name, socket_path=socket_path, colors=colors
504+
socket_name=socket_name,
505+
socket_path=socket_path,
506+
colors=colors,
507+
config_file=tmux_config_file,
502508
)
503509

504510
which('tmux') # raise exception if tmux not found
@@ -742,6 +748,7 @@ def command_freeze(session_name, socket_name, socket_path):
742748
@click.argument('config', type=ConfigPath(exists=True), nargs=-1)
743749
@click.option('-S', 'socket_path', help='pass-through for tmux -S')
744750
@click.option('-L', 'socket_name', help='pass-through for tmux -L')
751+
@click.option('-f', 'tmux_config_file', help='pass-through for tmux -f')
745752
@click.option('--yes', '-y', 'answer_yes', help='yes', is_flag=True)
746753
@click.option(
747754
'-d', 'detached', help='Load the session without attaching it', is_flag=True
@@ -759,7 +766,7 @@ def command_freeze(session_name, socket_name, socket_path):
759766
flag_value=88,
760767
help='Like -2, but indicates that the terminal supports 88 colours.',
761768
)
762-
def command_load(ctx, config, socket_name, socket_path, answer_yes, detached, colors):
769+
def command_load(ctx, config, socket_name, socket_path, tmux_config_file, answer_yes, detached, colors):
763770
"""Load a tmux workspace from each CONFIG.
764771
765772
CONFIG is a specifier for a configuration file.
@@ -787,6 +794,7 @@ def command_load(ctx, config, socket_name, socket_path, answer_yes, detached, co
787794
tmux_options = {
788795
'socket_name': socket_name,
789796
'socket_path': socket_path,
797+
'tmux_config_file': tmux_config_file,
790798
'answer_yes': answer_yes,
791799
'colors': colors,
792800
'detached': detached,

0 commit comments

Comments
 (0)