1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-11-23 01:06:17 +00:00

Added Any.toPrettyJson().

This commit is contained in:
Fabian Schlenz 2018-01-29 06:13:18 +01:00
parent 004b650762
commit ab16c44de5
2 changed files with 3 additions and 4 deletions

View File

@ -52,6 +52,7 @@ class CommandLineController {
init { init {
logger.info("CommandLineController started. App version {}", Config.APP_APPVER) logger.info("CommandLineController started. App version {}", Config.APP_APPVER)
this.printHeader() this.printHeader()
if (CommandLineOptions.cmd_version) { if (CommandLineOptions.cmd_version) {
System.exit(0) System.exit(0)

View File

@ -182,7 +182,5 @@ fun String.anonymize(): String {
return if (!CommandLineOptions.cmd_anonymize) this else this.replace(Regex("[0-9]"), "1").replace(Regex("[A-Z]"), "A").replace(Regex("[a-z]"), "a") + " (ANONYMIZED)" return if (!CommandLineOptions.cmd_anonymize) this else this.replace(Regex("[0-9]"), "1").replace(Regex("[A-Z]"), "A").replace(Regex("[a-z]"), "a") + " (ANONYMIZED)"
} }
fun Any.toJson(): String { fun Any.toJson(): String = Gson().toJson(this)
fun Any.toPrettyJson(): String = GsonBuilder().setPrettyPrinting().create().toJson(this)
return Gson().toJson(this)
}