c329e263f2
use the proper `command` command fix the redirection to /dev/null
42 lines
1.2 KiB
Bash
Executable File
42 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
######################################################################
|
|
# @author : swytch
|
|
# @file : mom
|
|
# @license : GPLv3
|
|
# @created : Wednesday May 20, 2020 18:19:56 CEST
|
|
#
|
|
# @description : create a groff doc with genereic metadata
|
|
# open it with (neo)vim
|
|
######################################################################
|
|
|
|
|
|
if [ -z ""$1"" ]; then
|
|
echo "Please provide a name for your file"
|
|
elif [ -e "$1" ]; then
|
|
echo "This filename is already taken, please provide a different name"
|
|
else
|
|
touch "$1" && \
|
|
echo "\# metadata" >> "$1" && \
|
|
echo '.AUTHOR "David JULIEN"' >> "$1" && \
|
|
echo '.TITLE' >> "$1" && \
|
|
echo '\# template' >> "$1" && \
|
|
echo '.PRINTSTYLE TYPESET' >> "$1" && \
|
|
echo '.QUOTE_STYLE QUAD' >> "$1" && \
|
|
echo '.SMARTQUOTES FR' >> "$1" && \
|
|
echo '.ATTRIBUTE_STRING "par"' >> "$1" && \
|
|
echo '.LINEBREAK_CHAR ""' >> "$1" && \
|
|
echo '\# cover' >> "$1" && \
|
|
echo '.COVER AUTHOR TITLE BLANKPAGE' >> "$1" && \
|
|
echo '.DOCHEADER OFF' >> "$1" && \
|
|
echo '\#' >> "$1" && \
|
|
echo '.START' >> "$1" && \
|
|
|
|
# checks if neovim is intalled
|
|
if command -v nvim > /dev/null 2>&1; then
|
|
nvim "$1"
|
|
else
|
|
vim "$1"
|
|
fi
|
|
fi
|