Popularity
1.8
Growing
Activity
6.6
-
15
3
2

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

arkenv alternatives and similar libraries

Based on the "Command Line Interface" category.
Alternatively, view arkenv alternatives based on common mentions on social networks and blogs.

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.