# !/usr/bin/env bash ## mfgames-project:v0.0.0 ## mfgames-project # Variables version=0.0.0 # Make sure we have the proper parameters. usage() { echo "USAGE $0 script.sh [script2.sh]" exit 1 } if [ "x$1" = "x" ] then usage fi # Go through the script and look for each one. for script in "$@" do # Write out the file. echo '# !/usr/bin/env bash' > .mfgames-project.tmp if [ -f $script ] then cat $script \ | sed -n '/usr.bin.env bash/!p' \ | sed '/^#mfgames-project:setup@/q' \ | sed -n '/mfgames-project:setup/!p' \ >> .mfgames-project.tmp else echo >> .mfgames-project.tmp fi echo "#mfgames-project:setup@v$version" >> .mfgames-project.tmp if [ -f $script ] && grep 'log() { echo' $script > /dev/null then grep 'log() { echo' $script >> .mfgames-project.tmp else case $script in build.sh) unicode="๐Ÿšง" ;; release.sh) unicode="๐Ÿšข" ;; setup.sh) unicode="๐ŸŒฑ" ;; test.sh) unicode="๐Ÿงช" ;; *) unicode=$(unipicker) ;; esac echo "log() { echo \"$unicode \$(basename \$0): \$@\"; }" >> .mfgames-project.tmp fi echo "cd \$(dirname \$(dirname \$0))" >> .mfgames-project.tmp echo "#mfgames-project:setup" >> .mfgames-project.tmp if [ -f $script ] then sed '1,/^#mfgames-project:setup$/d' < $script >> .mfgames-project.tmp fi # Finish up and make the script executable. mv .mfgames-project.tmp $script chmod a+x $script done