#!/usr/bin/env bash # Usage: scripts/new.sh [p|s] # SPDX-FileCopyrightText: 2024 Julien Moutinho (adh14) # SPDX-License-Identifier: AGPL-3.0-or-later # shellcheck disable=SC2086 # shellcheck disable=SC2154 set -eux rfcCat=$1; shift test $# -le 0 || declare "$@" rfcLastAdvocacy=$(find "${0%/*}"/rfcs -maxdepth 1 -type d -name "$rfcCat*" | sort -n | tail -1) rfcLastNum=$(realpath --relative-to "${0%/*}"/rfcs "$rfcLastAdvocacy") rfcLastNum=${rfcLastNum#"$rfcCat"} rfcNum=$((rfcLastNum + 1)) rfcDir="rfcs/$rfcCat$rfcNum" rfcAdvocacy="$rfcDir/advocacy.md" mkdir -p "$rfcDir" cat >>"$rfcAdvocacy" <>"} To: Cc: In-Reply-To: SPDX-FileCopyrightText: $(date +%Y) ${rfcAuthor-"$(git config user.name) <$(git config user.email)>"} SPDX-License-Identifier: CC-BY-4.0 RFC-Branch: ${rfcBranch} RFC-Category: $(case "$rfcCat" in (p) echo problème;; (s) echo solution;; esac) RFC-Compasses: $(printf -- " - %s\n" ${rfcCompasses}) RFC-Phase: RFC-Status: brouillon ... EOF cat >&2 <