]> Git — Sourcephile - julm/rezine-rfcs.git/blob - scripts/new.sh
p1: étude des bilans moraux de SCANI
[julm/rezine-rfcs.git] / scripts / new.sh
1 #!/usr/bin/env bash
2 # Usage: scripts/new.sh [p|s]
3 # SPDX-FileCopyrightText: 2024 Julien Moutinho (adh14) <julm+rezine@autogeree.net>
4 # SPDX-License-Identifier: AGPL-3.0-or-later
5 # shellcheck disable=SC2086
6 # shellcheck disable=SC2154
7 set -eux
8
9 rfcCat=$1; shift
10 test $# -le 0 || declare "$@"
11
12 rfcLastAdvocacy=$(find "${0%/*}"/rfcs -maxdepth 1 -type d -name "$rfcCat*" | sort -n | tail -1)
13 rfcLastNum=$(realpath --relative-to "${0%/*}"/rfcs "$rfcLastAdvocacy")
14 rfcLastNum=${rfcLastNum#"$rfcCat"}
15 rfcNum=$((rfcLastNum + 1))
16 rfcDir="rfcs/$rfcCat$rfcNum"
17 rfcAdvocacy="$rfcDir/advocacy.md"
18
19 mkdir -p "$rfcDir"
20 cat >>"$rfcAdvocacy" <<EOF
21 ---
22 title: ""
23 subtitle: ""
24 title-prefix: "\${rfcOrga} RFC\${rfcTag}"
25 date: \${rfcDateAdvocacy}
26 author:
27 - ${rfcAuthor-"$(git config user.name) <<$(git config user.email)>>"}
28 To:
29 Cc:
30 In-Reply-To:
31 SPDX-FileCopyrightText: $(date +%Y) ${rfcAuthor-"$(git config user.name) <$(git config user.email)>"}
32 SPDX-License-Identifier: CC-BY-4.0
33 RFC-Branch: ${rfcBranch}
34 RFC-Category: $(case "$rfcCat" in (p) echo problème;; (s) echo solution;; esac)
35 RFC-Compasses:
36 $(printf -- " - %s\n" ${rfcCompasses})
37 RFC-Phase:
38 RFC-Status: brouillon
39 ...
40
41 EOF
42 cat >&2 <<EOF
43 New RFC draft: $rfcAdvocacy
44
45 To preview: ${0%/*}/html.sh $rfcDir
46 To tag and push: ${0%/*}/tag.sh $rfcDir
47 To send mail: ${0%/*}/send.sh $rfcDir
48 EOF