-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile-readme.sh
executable file
·74 lines (46 loc) · 1.53 KB
/
compile-readme.sh
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
68
69
70
71
72
73
74
#!/bin/bash
License=$(cat ./LICENSE)
echo "# cli-utils
Additional command to make a variety of my daily tasks easier.
_The following readme is mainly automatically generated from the help menu of each command._
## Installation
Use \`sudo make target1 target2 ...\` to install all the commands. \"target\" here are the title of the sections in \"__Commands__\".
If you want to install all the target you can run \`sudo make all\`, if you run \`sudo make\`, only the \`base\` target will be installed.
\`sudo make update\` will only update already installed package.
# Commands
## Base
" > ./README.md
for executables in $(cd cmds && find "." -maxdepth 1 -executable -type f); do
help=$( cd cmds && ${executables} -h )
help_after_update=$( echo "${help}" | grep -A 100 -m 1 -e 'Updates' | tail -n +3 )
filename="${executables:2}"
filename="${filename%.*}"
echo "### _${filename}_
\`\`\`bash
${help_after_update}
\`\`\`
" >> ./README.md
done
for target in $(cd cmds && find "." -maxdepth 1 -type d); do
if [ "${target}" = "." ]; then
continue
fi
target="${target:2}"
echo "## ${target}
" >> ./README.md
for executables in $(cd cmds/${target} && find "." -maxdepth 1 -executable -type f); do
help=$( cd cmds/${target} && ${executables} -h )
help_after_update=$( echo "${help}" | grep -A 100 -m 1 -e 'Updates' | tail -n +3 )
filename="${executables:2}"
filename="${filename%.*}"
echo "### _${filename}_
\`\`\`bash
${help_after_update}
\`\`\`
" >> ./README.md
done
done
echo "
# License
${License}
" >> ./README.md