aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/ftv
diff options
context:
space:
mode:
authorYaroslav <contact@yaroslavps.com>2020-06-15 00:28:32 +0300
committerYaroslav <contact@yaroslavps.com>2020-06-15 00:28:32 +0300
commit2eec23a2c6b936d433ed396e3447f270290a7cb7 (patch)
tree53dc80ccef645e5bf2bd539ecb521621fa34cc59 /dotfiles/.local/bin/ftv
parentbd98ceb916d838f144f9e6c55bfbb11f33ed906b (diff)
downloadswayrice-2eec23a2c6b936d433ed396e3447f270290a7cb7.tar.gz
swayrice-2eec23a2c6b936d433ed396e3447f270290a7cb7.zip
script to start file from template
Diffstat (limited to 'dotfiles/.local/bin/ftv')
-rwxr-xr-xdotfiles/.local/bin/ftv21
1 files changed, 21 insertions, 0 deletions
diff --git a/dotfiles/.local/bin/ftv b/dotfiles/.local/bin/ftv
new file mode 100755
index 0000000..4b79083
--- /dev/null
+++ b/dotfiles/.local/bin/ftv
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# Script to start a new textfile from template
+
+templdir=$HOME"/docs/templates/"
+
+if [ -z "$2" ]; then
+ echo "Specify template filename and new filename"
+ exit 0
+fi
+
+template="$templdir$1"
+file=$(readlink -f "$2")
+
+if [ ! -f "$template" ]; then
+ echo "Template $1 does not exist"
+ exit 0
+fi
+
+cp $template $file
+nvim $file