-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader
More file actions
executable file
·39 lines (33 loc) · 894 Bytes
/
header
File metadata and controls
executable file
·39 lines (33 loc) · 894 Bytes
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
#! /usr/bin/env bash
AUTHOR="IBArbitrary"
name=$(echo $0 | cut -d "/" -f5)
function usage {
echo "Usage: $name [ -t HEADER-TEXT ] [ -c COMMENT-CHAR ] [ -r RULE_CHAR ]"
exit 1
}
while getopts 't:c:r:h' flag; do
case "${flag}" in
t) header="${OPTARG}" ;;
c) comment="${OPTARG}" ;;
r) rule="${OPTARG}" ;;
h) usage ;;
esac
done
rule=$(printf "$comment";printf "$rule%.0s" {1..79})
appname=$(while IFS= read -r line; do
echo "$line" | sed -e "s/^/$comment /"
done <<< $(toilet -f "ANSI Shadow" $header) | sed '$d')
auth=$(while IFS= read -r line; do
echo "$line" | sed -e "s/^/$comment /"
done <<< $(toilet -f rustofat $AUTHOR))
function makeHeader {
echo "$rule"
echo "$appname"
echo "$rule"
echo "$auth"
echo "$rule"
}
out=$(makeHeader)
printf "$out" | xclip -selection clipboard
printf "$out"
exit 0