Add "new" and "edit" commands

This commit is contained in:
2012-04-22 12:40:36 +01:00
parent 5b73edcead
commit 85fbda7e27
7 changed files with 149 additions and 1 deletions

28
libexec/tmuxifier-new-window Executable file
View File

@@ -0,0 +1,28 @@
#! /usr/bin/env bash
set -e
[ -n "$TMUXIFIER_DEBUG" ] && set -x
if [ -z "$1" ]; then
echo "usage: tmuxifier new-window <layout_name>" >&2
exit 1
fi
layout_name="$1"
layout_file="$TMUXIFIER_LAYOUT_PATH/${layout_name}.window.sh"
template="$TMUXIFIER/templates/window.sh"
if [ ! -f "$template" ]; then
echo "tmuxifier: window layout template not found: $template" >&2
exit 1
fi
if [ -f "$layout_file" ]; then
echo "window layout '$layout_name' already exists." >&2
echo "" >&2
echo "You can edit it with:" >&2
echo " tmuxifier edit-window $layout_name" >&2
exit 1
fi
cp "$template" "$layout_file"
exec "$EDITOR" "$layout_file"