-
Notifications
You must be signed in to change notification settings - Fork 634
Expand file tree
/
Copy path_adr_generate_table
More file actions
67 lines (59 loc) · 1.19 KB
/
Copy path_adr_generate_table
File metadata and controls
67 lines (59 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
set -e
eval "$($(dirname $0)/adr-config)"
## usage: adr generate table [-i INTRO] [-o OUTRO] [-p LINK_PREFIX]
##
## Generates a table in Markdown format to stdout that contains the ADR name and status.
##
## Options:
##
## -i INTRO precede the table with the given INTRO text.
## -o OUTRO follow the table with the given OUTRO text.
## -p LINK_PREFIX
## prefix each decision file link with LINK_PREFIX.
##
## Both INTRO and OUTRO must be in Markdown format.
args=$(getopt i:o:p: $*)
set -- $args
link_prefix=
for arg
do
case "$arg"
in
-i)
intro="$2"
shift 2
;;
-o)
outro="$2"
shift 2
;;
-p)
link_prefix="$2"
shift 2
;;
--)
shift
break
;;
esac
done
if [ ! -z $intro ]
then
cat "$intro"
echo
fi
echo "|ADR|Status|"
echo "|---|---|"
for f in $("$adr_bin_dir/adr-list")
do
title=$("$adr_bin_dir/_adr_title" $f)
link=${link_prefix}$(basename $f)
status=$("$adr_bin_dir/_adr_status" $f)
echo "|[$title]($link)|$status|"
done
if [ ! -z $outro ]
then
echo
cat "$outro"
fi