Upgrade yt-dlp from version stable@2023.07.06 to stable@2023.09.24
[sunny256-utils.git] / create-ly
blob970e89c291b77479f3a9c30e8c54676d44e91138
1 #!/usr/bin/env bash
3 #=======================================================================
4 # create-ly
5 # File ID: 09750024-f729-11e5-a74f-02010e0a6634
7 # Set up the initial files for a LilyPond project
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #=======================================================================
13 progname=create-ly
14 VERSION=0.3.4
16 ARGS="$(getopt -o "\
20 " -l "\
21 help,\
22 quiet,\
23 verbose,\
24 version,\
25 " -n "$progname" -- "$@")"
26 test "$?" = "0" || exit 1
27 eval set -- "$ARGS"
29 opt_help=0
30 opt_quiet=0
31 opt_verbose=0
32 while :; do
33 case "$1" in
34 -h|--help) opt_help=1; shift ;;
35 -q|--quiet) opt_quiet=$(($opt_quiet + 1)); shift ;;
36 -v|--verbose) opt_verbose=$(($opt_verbose + 1)); shift ;;
37 --version) echo $progname $VERSION; exit 0 ;;
38 --) shift; break ;;
39 *) echo $progname: Internal error >&2; exit 1 ;;
40 esac
41 done
42 opt_verbose=$(($opt_verbose - $opt_quiet))
44 if test "$opt_help" = "1"; then
45 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
46 cat <<END
48 Set up the initial files for a LilyPond project
50 Usage: $progname [options] TYPE PROJECTNAME
52 Argument \$1 is the type of project. These values are accepted:
53 band - pop/rock band with one vocal, two guitars, one bass, piano and
54 drums
55 guitar - one guitar
56 piano - standard setup for one piano
58 Argument \$2 is the name of the directory to create and the name of the
59 main .ly file, which will be named "PROJECTNAME.ly".
61 Options:
63 -h, --help
64 Show this help.
65 -q, --quiet
66 Be more quiet. Can be repeated to increase silence.
67 -v, --verbose
68 Increase level of verbosity. Can be repeated.
69 --version
70 Print version information.
72 END
73 exit 0
76 if test -z "$2"; then
77 echo $progname: I need two arguments with type and project name >&2
78 exit 1
81 projtype="$1"
82 projname="$2"
84 mkdir "$projname" || {
85 echo $progname: $projname: Cannot create directory >&2
86 exit 1
88 cd "$projname" || {
89 echo $progname: $projname: Cannot chdir >&2
90 exit 1
93 if test "$projtype" = "band"; then
94 for f in bass chords click drums guitar1 guitar2 \
95 piano-lower piano-upper vocal1; do
96 std ly/$f.ily $f.ily -t "projname=$projname"
97 done
98 std ly/band.ly "$projname.ly" -t "projname=$projname"
99 for f in bass chords click drums guitar1 guitar2 piano vocal1; do
100 std ly/$f.ly $f.ly -t "projname=$projname"
101 done
102 elif test "$projtype" = "guitar"; then
103 std ly/chords.ily chords.ily -t "projname=$projname"
104 std ly/chords.ly chords.ly -t "projname=$projname"
105 std ly/click.ily click.ily -t "projname=$projname"
106 std ly/click.ly click.ly -t "projname=$projname"
107 std ly/guitar.ily guitar.ily -t "projname=$projname"
108 std ly/guitar.ly "$projname.ly" -t "projname=$projname"
109 elif test "$projtype" = "piano"; then
110 std ly/chords.ily chords.ily -t "projname=$projname"
111 std ly/chords.ly chords.ly -t "projname=$projname"
112 std ly/click.ily click.ily -t "projname=$projname"
113 std ly/click.ly click.ly -t "projname=$projname"
114 std ly/piano-lower.ily piano-lower.ily -t "projname=$projname"
115 std ly/piano-upper.ily piano-upper.ily -t "projname=$projname"
116 std ly/piano.ly "$projname.ly" -t "projname=$projname"
117 else
118 echo $progname: $projtype: Unknown project type >&2
119 exit 1
122 std ly/defs.ily defs.ily
123 std ly/Makefile Makefile -t "projname=$projname"
124 git ignore .version.ily $projname.mp3 $projname.opus \
125 $projname.pdf $projname.wav