Information about how the command was invoked. You can access this on the @weex-cli/core. Check out this example of creating a new Weex Toolkit plugin.

weex log welcome to weex --color red --cache
nametypepurposefrom the example above
commandstringthe command used'log'
stringstringthe command arguments as a string'welcome to weex
arrayarraythe command arguments as an array['welcome', 'to', 'weex']
firststringthe 1st argument'welcome'
secondstringthe 2nd argument'to'
thirdstringthe 3rd argument'weex'
optionsobjectcommand line options{cache: true, color: 'red'}
argvobjectraw argv

options

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

weex log --color red --small --no-cache
module.exports = async function(context) {
  context.parameters.options // { color: red, small: true, cache: false, ...}
}

Also there has some useful function or data on the options by default. such as context.parameters.options.__config, context.parameters.options.__analyzer.

string

Everything else after the command as a string.

weex log hello there
module.exports = async function(context) {
  context.parameters.string // 'hello there'
}

array

Everything else after the command, but as an array.

weex log say yeah
module.exports = async function(context) {
  context.parameters.array // ['say', 'yeah']
}

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.

weex log welcome to weex
module.exports = async function(context) {
  context.parameters.first // 'welcome'
  context.parameters.second // 'to'
  context.parameters.third // 'weex'
}