-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcreate-ly
executable file
·111 lines (94 loc) · 2.83 KB
/
create-ly
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env bash
#=======================================================================
# create-ly
# File ID: 09750024-f729-11e5-a74f-02010e0a6634
#
# Set up the initial files for a LilyPond project
#
# Author: Øyvind A. Holm <[email protected]>
# License: GNU General Public License version 2 or later.
#=======================================================================
progname=create-ly
VERSION=0.2.1
ARGS="$(getopt -o "\
h\
q\
v\
" -l "\
help,\
quiet,\
verbose,\
version,\
" -n "$progname" -- "$@")"
test "$?" = "0" || exit 1
eval set -- "$ARGS"
opt_help=0
opt_quiet=0
opt_verbose=0
while :; do
case "$1" in
-h|--help) opt_help=1; shift ;;
-q|--quiet) opt_quiet=$(($opt_quiet + 1)); shift ;;
-v|--verbose) opt_verbose=$(($opt_verbose + 1)); shift ;;
--version) echo $progname $VERSION; exit 0 ;;
--) shift; break ;;
*) echo $progname: Internal error >&2; exit 1 ;;
esac
done
opt_verbose=$(($opt_verbose - $opt_quiet))
if test "$opt_help" = "1"; then
test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
cat <<END
Set up the initial files for a LilyPond project
Usage: $progname [options] TYPE PROJECTNAME
Argument \$1 is the type of project. These values are accepted:
band - pop/rock band with one vocal, two guitars, one bass, piano and
drums
guitar - one guitar
piano - standard setup for one piano
Argument \$2 is the name of the directory to create and the name of the
main .ly file, which will be named "PROJECTNAME.ly".
Options:
-h, --help
Show this help.
-q, --quiet
Be more quiet. Can be repeated to increase silence.
-v, --verbose
Increase level of verbosity. Can be repeated.
--version
Print version information.
END
exit 0
fi
if test -z "$2"; then
echo $progname: I need two arguments with type and project name >&2
exit 1
fi
projtype="$1"
projname="$2"
mkdir "$projname" || {
echo $progname: $projname: Cannot create directory >&2
exit 1
}
cd "$projname" || {
echo $progname: $projname: Cannot chdir >&2
exit 1
}
if test "$projtype" = "band"; then
for f in bass drums guitar1 guitar2 piano-lower piano-upper vocal1; do
std ly/$f.ily $f.ily -t "projname=$projname"
done
std ly/band.ly "$projname.ly" -t "projname=$projname"
elif test "$projtype" = "guitar"; then
std ly/guitar.ily guitar.ily -t "projname=$projname"
std ly/guitar.ly "$projname.ly" -t "projname=$projname"
elif test "$projtype" = "piano"; then
std ly/piano-lower.ily piano-lower.ily -t "projname=$projname"
std ly/piano-upper.ily piano-upper.ily -t "projname=$projname"
std ly/piano.ly "$projname.ly" -t "projname=$projname"
else
echo $progname: $projtype: Unknown project type >&2
exit 1
fi
std ly/Makefile Makefile -t "projname=$projname"
git ignore .version.ily $projname.pdf $projname.wav