#!/usr/bin/env 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 printf 'Please provide a name for your file\n' elif [ -e "$1" ]; then printf 'This filename is already taken, please provide a different name\n' else touch "$1" && \ printf '\# metadata' >> "$1" && \ printf '\n.AUTHOR "David JULIEN"' >> "$1" && \ printf '\n.TITLE' >> "$1" && \ printf '\n\# template' >> "$1" && \ printf '\n.PRINTSTYLE TYPESET' >> "$1" && \ printf '\n.QUOTE_STYLE QUAD' >> "$1" && \ printf '\n.SMARTQUOTES FR' >> "$1" && \ printf '\n.ATTRIBUTE_STRING "par"' >> "$1" && \ printf '\n.LINEBREAK_CHAR ""' >> "$1" && \ printf '\n\# cover' >> "$1" && \ printf '\n.COVER AUTHOR TITLE BLANKPAGE' >> "$1" && \ printf '\n.DOCHEADER OFF' >> "$1" && \ printf '\n\#' >> "$1" && \ printf '\n.START' >> "$1" && \ # checks if neovim is intalled if command -v nvim > /dev/null 2>&1; then nvim "$1" else vim "$1" fi fi