Skip to content

Commit

Permalink
Add a debug option for more verbose logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedre committed Jun 11, 2022
1 parent f7b6c7a commit d9045be
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/main/kotlin/net/cafesalam/profilerutil/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.github.ajalt.clikt.parameters.groups.provideDelegate
import com.github.ajalt.clikt.parameters.groups.required
import com.github.ajalt.clikt.parameters.options.convert
import com.github.ajalt.clikt.parameters.options.default
import com.github.ajalt.clikt.parameters.options.flag
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.options.required
import com.github.ajalt.clikt.parameters.types.file
Expand All @@ -34,6 +35,7 @@ class CheckDeltas : CliktCommand() {
option("--auth-file").file().convert { it.readText() },
option("--auth-string").convert { it.decodeBase64()?.utf8() ?: "" }
).required()
private val debug by option("--debug").flag()

override fun run() {
val spreadsheetService = SpreadsheetService()
Expand All @@ -43,7 +45,8 @@ class CheckDeltas : CliktCommand() {
width,
threshold,
spreadsheetOptions.spreadsheetId,
spreadsheetOptions.spreadsheetReadRange
spreadsheetOptions.spreadsheetReadRange,
debug
)
}
}
Expand Down
15 changes: 12 additions & 3 deletions src/main/kotlin/net/cafesalam/profilerutil/task/CheckDeltaUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,22 @@ import net.cafesalam.profilerutil.sheets.SpreadsheetUtil

object CheckDeltaUtil {

fun checkForNotableDelta(sheetsService: Sheets, width: Int, threshold: Int, spreadsheetId: String, range: String) {
fun checkForNotableDelta(
sheetsService: Sheets,
width: Int,
threshold: Int,
spreadsheetId: String,
range: String,
debug: Boolean
) {
val responseValues = SpreadsheetUtil.readRangeFromSheet(sheetsService, spreadsheetId, range)
if (responseValues.isEmpty()) {
println("No data found")
} else {
responseValues.forEach { row ->
println(row)
if (debug) {
responseValues.forEach { row ->
println(row)
}
}

val numberOfRunsToConsider = 1 + (2 * width)
Expand Down

0 comments on commit d9045be

Please sign in to comment.