From 740882bed483ac5e03b7d6534e08881769fba596 Mon Sep 17 00:00:00 2001 From: tiynger Date: Wed, 16 Oct 2019 16:55:09 +0200 Subject: [PATCH] making template copy function --- .config/aliasrc | 5 ----- .local/bin/tools/textemp | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) create mode 100755 .local/bin/tools/textemp diff --git a/.config/aliasrc b/.config/aliasrc index f070321..8c05d15 100644 --- a/.config/aliasrc +++ b/.config/aliasrc @@ -25,11 +25,6 @@ alias config="/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME" sc() { find ~/.config/* ~/.local/bin/* -type f | fzf | xargs -r $EDITOR ;} sd() { find ~/ownCloud/* -type f | grep ".pdf" | fzf | xargs -r $READER ;} -# git -texhandout() { - [[ -z $1 ]] && echo "missing argument: filename (no ending)" && return 1 - cp ~/gitrepos/Tools/LaTeX\ Templates/LaTeX\ Handout/Handout.tex $1.tex && compile $1.tex -} # grep alias grep="grep --color=auto" diff --git a/.local/bin/tools/textemp b/.local/bin/tools/textemp new file mode 100755 index 0000000..a4d2e6d --- /dev/null +++ b/.local/bin/tools/textemp @@ -0,0 +1,27 @@ +#!/usr/bin/env sh +# copying tex templates + +[ -z "$2" ] && echo "missing argument: filename (no ending)" && return 1 + +articletemp=~/gitrepos/Tools/LaTeX\ Templates/LaTeX\ Article/Article.tex +beamertemp=~/gitrepos/Tools/LaTeX\ Templates/LaTeX\ Beamer/Beamer.tex +exercisetemp=~/gitrepos/Tools/LaTeX\ Templates/LaTeX\ Exercise\ Header/Header.tex +handouttemp=~/gitrepos/Tools/LaTeX\ Templates/LaTeX\ Handout/Handout.tex + +case "$1" in + a*) cp "$articletemp" $2.tex ;; + b*) cp "$beamertemp" $2.tex ;; + e*) cp "$exercisetemp" $2.tex ;; + h*) cp "$handouttemp" $2.tex ;; + *) cat << EOF + +Allowed options + article NAME get handout-template with given NAME + beamer NAME get handout-template with given NAME + exercise NAME get handout-template with given NAME + handout NAME get handout-template with given NAME + +All of these commands can be truncated, +i.e. \`textemp a\` for \`textemp article`\. +EOF +esac