<commit_before>package com.github.K0zka.kerub.utils.junix.qemu

import com.github.K0zka.kerub.host.executeOrDie
import com.github.K0zka.kerub.model.io.VirtualDiskFormat
import com.github.K0zka.kerub.utils.createObjectMapper
import org.apache.sshd.client.session.ClientSession
import java.math.BigInteger

/**
 * Utility wrapper around qemu-img
 * See http://manpages.ubuntu.com/manpages/utopic/man1/qemu-img.1.html
 */
object QemuImg {
	val objectMapper = createObjectMapper()
	fun create(
			session: ClientSession,
			format: VirtualDiskFormat = VirtualDiskFormat.raw,
			size: BigInteger,
			path: String
	) {
		session.executeOrDie("qemu-img create -f ${format} ${path} ${size}")
	}

	fun info(session: ClientSession, path: String): ImageInfo {
		val ret = session.executeOrDie("qemu-img info ${path}")
		return objectMapper.readValue(ret, ImageInfo::class.java)
	}

	fun resize(session: ClientSession, path: String, size: BigInteger) {
		session.executeOrDie("qemu-img resize ${path} ${size}")
	}

	fun convert(session: ClientSession, path: String, targetPath: String, targetFormat: VirtualDiskFormat) {
		session.executeOrDie("qemu-img convert -O ${targetFormat} ${path} ${targetPath}")
	}
}<commit_msg>cleanup: curly braces in string template<commit_after>package com.github.K0zka.kerub.utils.junix.qemu

import com.github.K0zka.kerub.host.executeOrDie
import com.github.K0zka.kerub.model.io.VirtualDiskFormat
import com.github.K0zka.kerub.utils.createObjectMapper
import org.apache.sshd.client.session.ClientSession
import java.math.BigInteger

/**
 * Utility wrapper around qemu-img
 * See http://manpages.ubuntu.com/manpages/utopic/man1/qemu-img.1.html
 */
object QemuImg {
	val objectMapper = createObjectMapper()
	fun create(
			session: ClientSession,
			format: VirtualDiskFormat = VirtualDiskFormat.raw,
			size: BigInteger,
			path: String
	) {
		session.executeOrDie("qemu-img create -f $format $path $size")
	}

	fun info(session: ClientSession, path: String): ImageInfo {
		val ret = session.executeOrDie("qemu-img info $path")
		return objectMapper.readValue(ret, ImageInfo::class.java)
	}

	fun resize(session: ClientSession, path: String, size: BigInteger) {
		session.executeOrDie("qemu-img resize $path $size")
	}

	fun convert(session: ClientSession, path: String, targetPath: String, targetFormat: VirtualDiskFormat) {
		session.executeOrDie("qemu-img convert -O $targetFormat $path $targetPath")
	}
}
{'fraction_non_alphanumeric': 0.12402142562834775, 'fraction_numerical': 0.004944375772558714, 'mean_word_length': 5.1938775510204085, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '532993', 'n_tokens_mistral': 842, 'n_tokens_neox': 797, 'n_words': 165}