<commit_before>#!/bin/bash

set -euo pipefail

base_template="
+++
date = \"%s\"
title = \"%s\"
slug = \"%s\"
tags = []
categories = []
+++
"

function create_post() {
    local title filename postslug postdate
    title="${1}"
    postdate="$(date +"%Y-%m-%d")"
    postslug="$(echo ${title:?} | tr -dc '[:alnum:][:space:]\n\r' | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g')"
    filename="${postslug}.md"
    printf "${base_template}" "${postdate}" "${title}" "${postslug}" > content/posts/"${filename}"
}

create_post "${@}"
<commit_msg>generate_post_skeleton: Shellcheck cleanup<commit_after>#!/bin/bash

set -euo pipefail

function create_post() {
    local title filename postslug postdate
    if [ $# -lt 1 ]; then
        echo -e "\033[01;31mProviding a title is a must!\033[0m"
        return
    else
        title="${@}"
    fi
    postdate="$(date +"%Y-%m-%d")"
    postslug="$(echo "${title}" | tr -dc '[:alnum:][:space:]\n\r' | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g')"
    filename="${postslug}.md"
    printf "+++\ndate = \"%s\"\ntitle = \"%s\"\nslug = \"%s\"\ntags = []\ncategories = []\n+++\n" "${postdate}" "${title}" "${postslug}" > content/posts/"${filename}"
}

create_post "${@}"

{'fraction_non_alphanumeric': 0.26556016597510373, 'fraction_numerical': 0.010788381742738589, 'mean_word_length': 3.466666666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4978794', 'n_tokens_mistral': 468, 'n_tokens_neox': 460, 'n_words': 97}