Ubuntu.Components Argument

The Argument class specifies what type a given command line parameter should be.

Import Statement: import Ubuntu.Components 1.3

Properties

Methods

  • string at(int i)

Detailed Description

Important: Argument is not used on its own but must be a child of Arguments.

An Argument is defined by its name and valueNames properties which correspond to a command line parameter (e.g. –target) and the values passed to it (e.g. –target=http://myaddress).

For example, the following code allows to retrieve parameters on the command line of the form –target=URL:

Argument {
    name: "target"
    help: "address of the resource to retrieve"
    required: true
    valueNames: ["URL"]
}

To retrieve a value passed to the parameter knowing its position, use the at method.

See also Arguments.

Property Documentation

help : string

Help displayed when launching the application with –usage.

name : string

Name identifying the command line argument.

For example ‘target’ corrsesponds to the ‘–target’ command line argument.

required : bool

Whether or not this argument needs to be passed on the command line when launching the application.

valueNames : list<string>

Names given to the values of this argument. They are used when displaying the expected command line arguments of the application.

Typically all capital letters (e.g. URL).

Method Documentation

string at(int i)

Returns the ith value of the argument. Values are counted from 0.