Home Manual Reference Source Test
import InitOption from 'atscm/src/lib/init/Option.js'
public class | source

InitOption

An option the "atscm init" command handles. TODO: Support function values for name, message, default, choices...

Test:

Static Member Summary

Static Public Members
public static get

The default inquirer~PromptType to use.

Constructor Summary

Public Constructor
public

constructor(messageOrOptions: string | Object, defaultOrUndefined: string | number)

Creates a new option based either on a message and (optionally) a default value or some options.

Member Summary

Public Members
public

The choices available.

public

The default value to use.

public

The option's message. A '?' sign is added automatically.

public

The option's inquirer~PromptType. Defaults to 'input'.

public

Validates the user input for this option.

public

A function or boolean that indicates weather or not to prompt this option.

Static Public Members

public static get DefaultType: inquirer~PromptType: string source

The default inquirer~PromptType to use. Equals 'input'.

Return:

inquirer~PromptType

The default inquirer~PromptType to use.

Public Constructors

public constructor(messageOrOptions: string | Object, defaultOrUndefined: string | number) source

Creates a new option based either on a message and (optionally) a default value or some options.

Params:

NameTypeAttributeDescription
messageOrOptions string | Object

The message or options to use.

messageOrOptions.type inquirer~PromptType
  • optional

The option's type.

messageOrOptions.message string

The option's message. Required if messageOrOptions is an object.

messageOrOptions.default string | number
  • optional

The options's default value.

messageOrOptions.validate inquirer~Validator
  • optional

A function that validates user input.

messageOrOptions.choices string[] | number[]
  • optional

The options's choices. Applies to to list types only.

messageOrOptions.when boolean | function(answers: Object): boolean
  • optional

Weather or not to prompt this option.

defaultOrUndefined string | number
  • optional

The default value to use.

Test:

Public Members

public choices: String[] | Number[] | undefined source

The choices available. Applies to list types only.

public default: String | Number | undefined source

The default value to use.

public message: String source

The option's message. A '?' sign is added automatically.

public type: inquirer~PromptType source

The option's inquirer~PromptType. Defaults to 'input'.

public validate: inquirer~Validator source

Validates the user input for this option.

public when: Boolean | function(answers: Object): Boolean | undefined source

A function or boolean that indicates weather or not to prompt this option.