Popularity
1.1
Growing
Activity
7.4
Declining
7
2
0

Programming language: Kotlin
Tags: Command Line Interface    
Latest version: v3.1.0

arkenv alternatives and similar libraries

Based on the "Command Line Interface" category

Do you think we are missing an alternative of arkenv or a related project?

Add another 'Command Line Interface' Library

README

Bintray Pipelines Pipelines Chat Awesome Kotlin Badge

Type-safe Kotlin configuration parser by delegates.

Supports the most common external configuration sources, including:

  • Command line
  • Environment Variables
  • Properties, Yaml & Spring-like profiles
  • .env files

📦 Installation

Add jcenter to your repositories and add Arkenv in Gradle:

repositories { jcenter() }
compile "com.apurebase:arkenv:$arkenv_version"

🔨 Usage

Define your arguments by extending Arkenv and declaring props with the argument delegate.

class Arguments : Arkenv() {

    val country: String by argument()

    val bool: Boolean by argument {
        description = "A bool, which will be false by default"
    }

    val port: Int by argument("-p", "--this-can-be-set-via-env") {
        description = "An Int with a default value and custom names"
        defaultValue = { 5000 }
    }

    val nullInt: Int? by argument {
        description = "A nullable Int, which doesn't have to be declared"
    }

    val mapped: List<String> by argument {
        description = "Complex types can be achieved with a mapping"
        mapping = { it.split("|") }
    }
}

If you don't specify any names for the argument, it will use the property's name.

In the case of nullInt, you can parse it like this:

  • From command line with --null-int world
  • As an environment variable NULL_INT=world

By default, Arkenv supports parsing command line arguments, environment variables, and profiles.

To get started, we recommend reading about the basics for a quick tour of what's included.

📃 Documentation

Please visit https://apurebase.gitlab.io/arkenv/ for in-depth documentation.

🤝 Contributing PRs Welcome

Slack

Find the Arkenv channel in the official Kotlin Slack.