mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 09:56:39 +00:00
Resolves issue #20. Additionally, load_session now has an optional second argument to set the default session name. And error output from both load commands is now printed to STDERR and give a return code of 1 on error.
39 lines
783 B
Bash
Executable File
39 lines
783 B
Bash
Executable File
#! /usr/bin/env bash
|
|
set -e
|
|
[ -n "$TMUXIFIER_DEBUG" ] && set -x
|
|
|
|
# Load internal utility functions.
|
|
source "$TMUXIFIER/lib/util.sh"
|
|
|
|
# Provide tmuxifier help
|
|
if calling-help "$@"; then
|
|
echo "usage: tmuxifier load-window <layout_name | file_path>
|
|
|
|
Aliases: window, win, w
|
|
|
|
Create a new window using the specified window layout in the current session."
|
|
exit
|
|
fi
|
|
|
|
# Provide tmuxifier completions
|
|
if calling-complete "$@"; then
|
|
tmuxifier-list-windows
|
|
exit
|
|
fi
|
|
|
|
if [ -z "$1" ]; then
|
|
echo "$(tmuxifier-help load-window $@)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Load runtime functions.
|
|
source "$TMUXIFIER/lib/runtime.sh"
|
|
|
|
if [ ! -z $TMUX ]; then
|
|
session="$(tmuxifier-current-session)"
|
|
load_window "$1"
|
|
else
|
|
echo "tmuxifier: 'load-window' command can only be used from within Tmux."
|
|
exit 1
|
|
fi
|