diff --git a/build.gradle b/build.gradle index 58794a2..1d5cc40 100644 --- a/build.gradle +++ b/build.gradle @@ -8,11 +8,13 @@ version '0.1.0-SNAPSHOT' repositories { mavenCentral() + maven { url 'https://jitpack.io' } } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" + implementation 'com.github.wulkanowy:api:fe7ebc7c54' implementation 'com.github.ajalt:clikt:1.6.0' } diff --git a/src/main/kotlin/io/github/wulkanowy/cli/Main.kt b/src/main/kotlin/io/github/wulkanowy/cli/Main.kt index 34eff80..c036e1c 100644 --- a/src/main/kotlin/io/github/wulkanowy/cli/Main.kt +++ b/src/main/kotlin/io/github/wulkanowy/cli/Main.kt @@ -1,11 +1,35 @@ package io.github.wulkanowy.cli import com.github.ajalt.clikt.core.CliktCommand +import com.github.ajalt.clikt.parameters.options.flag +import com.github.ajalt.clikt.parameters.options.option +import com.github.ajalt.clikt.parameters.options.prompt +import io.github.wulkanowy.api.Api +import okhttp3.logging.HttpLoggingInterceptor class Hello : CliktCommand() { + private val debug by option().flag() + + private val api = Api() + + private val nick by option().prompt() + + private val pass by option().prompt(hideInput = true) + override fun run() { - echo("Hello World!") + api.apply { + logLevel = if (debug) HttpLoggingInterceptor.Level.BODY else HttpLoggingInterceptor.Level.NONE + host = "vulcan.net.pl" + email = nick + password = pass + } + + echo("Ładowanie...") + + val students = api.getStudents().blockingGet() + echo("Znaleziono uczniów:") + students.forEach { echo("${it.studentName} - ${it.description}") } } }