6 Commits

Author SHA1 Message Date
a7473208c0 Bump version to 0.8.0 2013-07-02 23:06:03 +02:00
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
da1354d5b7 Bump version to 0.7.3 2013-06-27 08:56:40 +02:00
f01c789de4 Fix typo 2013-06-27 08:55:43 +02:00
b52ef20be8 Merge pull request #22 from limeyd/master
Add optional window name when loading windows
2013-06-26 23:54:38 -07:00
limeyd
212693b1e9 added optional window name 2013-06-26 20:55:29 -06:00
5 changed files with 35 additions and 12 deletions

View File

@@ -143,12 +143,22 @@ window_root() {
# Load specified window layout. # Load specified window layout.
# #
# Arguments: # Arguments:
# - $1: Name of window layout to load. # - $1: Name of or file path to window layout to load.
# - $2: (optional) Override default window name.
# #
load_window() { load_window() {
local file="$TMUXIFIER_LAYOUT_PATH/$1.window.sh" local file="$1"
if [ ! -f "$file" ]; then
file="$TMUXIFIER_LAYOUT_PATH/$1.window.sh"
fi
if [ -f "$file" ]; then if [ -f "$file" ]; then
window="$1" if [ $# -gt 1 ]; then
window="$2"
else
window="${1/%.window.sh}"
window="${window/%.sh}"
fi
source "$file" source "$file"
window= window=
@@ -157,19 +167,31 @@ load_window() {
window_root "$session_root" window_root "$session_root"
fi fi
else else
echo "No such window layout found '$1' in '$TMUXIFIER_LAYOUT_PATH'." echo "\"$1\" window layout not found." >&2
return 1
fi fi
} }
# Load specified session layout. # Load specified session layout.
# #
# Arguments: # Arguments:
# - $1: Name of session layout to load. # - $1: Name of or file path to session layout to load.
# - $2: (optional) Override default window name.
# #
load_session() { load_session() {
local file="$TMUXIFIER_LAYOUT_PATH/$1.session.sh" local file="$1"
if [ ! -f "$file" ]; then
file="$TMUXIFIER_LAYOUT_PATH/$1.session.sh"
fi
if [ -f "$file" ]; then if [ -f "$file" ]; then
session="$1" if [ $# -gt 1 ]; then
session="$2"
else
session="${1/%.session.sh}"
session="${session/%.sh}"
fi
set_default_path=true set_default_path=true
source "$file" source "$file"
session= session=
@@ -179,7 +201,8 @@ load_session() {
session_root="$HOME" session_root="$HOME"
fi fi
else else
echo "No such session layout found '$1' in '$TMUXIFIER_LAYOUT_PATH'." echo "\"$1\" session layout not found." >&2
return 1
fi fi
} }

View File

@@ -4,7 +4,7 @@ set -e
# Set shell to first argument that is not "-", "-h" or "--help". # Set shell to first argument that is not "-", "-h" or "--help".
for arg in "$@"; do for arg in "$@"; do
if [ "$arg" != "-" ] &&[ "$arg" != "-h" ] && [ "$arg" != "--help" ]; then if [ "$arg" != "-" ] && [ "$arg" != "-h" ] && [ "$arg" != "--help" ]; then
shell="$arg" shell="$arg"
fi fi
done done

View File

@@ -7,7 +7,7 @@ source "$TMUXIFIER/lib/util.sh"
# Provide tmuxifier help # Provide tmuxifier help
if calling-help "$@"; then if calling-help "$@"; then
echo "usage: tmuxifier load-session <layout_name> echo "usage: tmuxifier load-session <layout_name | file_path>
Aliases: session, ses, s Aliases: session, ses, s

View File

@@ -7,7 +7,7 @@ source "$TMUXIFIER/lib/util.sh"
# Provide tmuxifier help # Provide tmuxifier help
if calling-help "$@"; then if calling-help "$@"; then
echo "usage: tmuxifier load-window <layout_name> echo "usage: tmuxifier load-window <layout_name | file_path>
Aliases: window, win, w Aliases: window, win, w

View File

@@ -13,4 +13,4 @@ Outputs Tmuxifier version."
exit exit
fi fi
echo "0.7.2" echo "0.8.0"