Skip to main content

parameters

Information about how the command was invoked. You can access this on the Gluegun toolbox. Check out this example of creating a new Reactotron plugin.

gluegun reactotron plugin MyAwesomePlugin full --comments --lint standard
nametypepurposefrom the example above
pluginstringthe plugin used'reactotron'
commandstringthe command used'plugin'
stringstringthe command arguments as a string'MyAwesomePlugin full'
arrayarraythe command arguments as an array['MyAwesomePlugin', 'full']
firststringthe 1st argument'MyAwesomePlugin'
secondstringthe 2nd argument'full'
thirdstringthe 3rd argumentundefined
optionsobjectcommand line options{comments: true, lint: 'standard'}
argvobjectraw argv

options

Options are the command line flags. Always exists however it may be empty.

gluegun say hello --loud -v --wave furiously
module.exports = async function (toolbox) {
toolbox.parameters.options // { loud: true, v: true, wave: 'furiously' }
}

string

Everything else after the command as a string.

gluegun say hello there
module.exports = async function (toolbox) {
toolbox.parameters.string // 'hello there'
}

array

Everything else after the command, but as an array.

gluegun reactotron plugin full
module.exports = async function (toolbox) {
toolbox.parameters.array // ['plugin', 'full']
}

first / .second / .third

The first, second, and third element in array. It is provided as a shortcut, and there isn't one, this will be undefined.

gluegun reactotron plugin full
module.exports = async function (toolbox) {
toolbox.parameters.first // 'plugin'
toolbox.parameters.second // 'full'
toolbox.parameters.third // undefined
}