Add various checks to print something useful when things go wrong

This commit is contained in:
2012-04-25 01:01:09 +01:00
parent 96b8abf1cb
commit ffe9327758
3 changed files with 22 additions and 2 deletions

View File

@@ -25,6 +25,8 @@ load_window() {
if [[ "$window_root" != "$session_root" ]]; then
window_root "$session_root"
fi
else
echo "No such window layout found '$1' in '$TMUXIFIER_LAYOUT_PATH'."
fi
}
@@ -39,6 +41,8 @@ load_session() {
if [[ "$session_root" != "$HOME" ]]; then
session_root="$HOME"
fi
else
echo "No such session layout found '$1' in '$TMUXIFIER_LAYOUT_PATH'."
fi
}

View File

@@ -26,4 +26,12 @@ fi
content="$(cat "$template")"
echo "${content/\{\{SESSION_NAME\}\}/$layout_name}" > "$layout_file"
exec "$EDITOR" "$layout_file"
if [ ! -z "$EDITOR" ]; then
exec "$EDITOR" "$layout_file"
else
echo "Layout file has been created, but '\$EDITOR' is not set. Please "
echo "manually open the layout for editing:"
echo "$layout_file"
echo
fi

View File

@@ -26,4 +26,12 @@ fi
content="$(cat "$template")"
echo "${content/\{\{WINDOW_NAME\}\}/$layout_name}" > "$layout_file"
exec "$EDITOR" "$layout_file"
if [ ! -z "$EDITOR" ]; then
exec "$EDITOR" "$layout_file"
else
echo "Layout file has been created, but '\$EDITOR' is not set. Please "
echo "manually open the layout for editing:"
echo "$layout_file"
echo
fi