Commits

Jack Frost  committed 34028c5

digger clone feature

  • Participants
  • Parent commits 363051e

Comments (0)

Files changed (1)

 
 digger.new() { mkdir "$digger_dir/$minecraft_instance"; }
 
+digger.clone() {
+	[[ -e "$digger_dir/$minecraft_instance" ]] && {
+		digger.err "$minecraft_instance already exists!"
+		return 1
+	}
+	
+	digger.msg "Copying $1 into $minecraft_instance"
+	cp -r "$digger_dir/$1" "$digger_dir/$minecraft_instance"
+}
+
 # Main part
-while getopts "chd:p:" option; do
+while getopts "chd:p:C:" option; do
 	case $option in
 		d) flag_get_jar='1'; jar_version="$OPTARG";;
 		p) flag_patch='1'; mod_zip="$OPTARG";;
 		c) flag_create='1';;
+		C) flag_clone='1'; clone_target="$OPTARG";;
 		h|?|*) digger.usage; exit;;
 	esac
 done
 
 [[ "$flag_create" ]] && { digger.new; }
 
+[[ "$flag_clone" ]] && {
+	digger.clone "$clone_target" || exit 29
+}
+
 [[ "$flag_get_jar" ]] && {
 	[[ "$flag_create" ]] && {
 		digger.err "-c and -d are mutually exclusive. You have to have a working instance to substitute minecraft.jar"