Arguments

interface Arguments

Unlike JavaFX, starting a Glok application is the same as any other JVM based application. Declare a 'main' function, and call launch.

Glok does not parse the command-line arguments for you, but does supply two functions that you can use if you wish : posixArguments, doubleDashArguments Both return Arguments.

You can parse the command line in the main method, or in Application.start, whichever is applicable to your needs. If you application works as a GUI as well as a command-line only program, it may even parse the arguments in both places.

There are a number of competing conventions for parsing command line arguments :

myProgram -fooValue    // Use posixArguments()
myProgram --foo=Value  // GNU's convention - no implementation supplied by Glok
myProgram --foo Value  // Use doubleDashArguments()

Functions

Link copied to clipboard
abstract fun dump()

Used for debugging - lists all parameters.

Link copied to clipboard
abstract fun flag(shortName: Char): Boolean

Is the single-character flag parameter present?

abstract fun flag(longName: String): Boolean

Is the multi-character flag parameter present?

open fun flag(shortName: Char, longName: String): Boolean

Is either the single-character or the equivalent multi-character flag present.

Link copied to clipboard
open operator fun get(name: String): String?

A Kotlin operator equivalent to value. i.e.

Link copied to clipboard
abstract fun remainder(): List<String>

Remaining (unnamed) parameters.

Link copied to clipboard
abstract fun value(name: String): String?

The value of a named parameter. If multiple values are present, then only the first is returned.

Link copied to clipboard
abstract fun values(name: String): List<String>

The values of a named parameter, which is expected to have multiple values. If no values are found, this returns an empty list.