Files
tmuxifier/libexec/tmuxifier-load-session
Jim Myhrberg 1dddbb502c Enable load commands to accept file paths in addition to layout names
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.
2013-07-02 23:05:18 +02:00

35 lines
707 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-session <layout_name | file_path>
Aliases: session, ses, s
Create a session using the session layout, unless the session already exists
in which case, we simply attach/switch to the existing one."
exit
fi
# Provide tmuxifier completions
if calling-complete "$@"; then
tmuxifier-list-sessions
exit
fi
if [ -z "$1" ]; then
echo "$(tmuxifier-help load-session $@)" >&2
exit 1
fi
# Load runtime functions.
source "$TMUXIFIER/lib/runtime.sh"
# Load session file.
load_session "$1"