Basic Command line syntax
We will try to understand this through an example.
Let's dissect the following example
/flightsearch Mumbai Delhi 26 Jan 2017
/flightsearch is the command which has 3 required arguments:
from-city, to-city, date
We type the required params in order and bam! we get the results.
/flightsearch Mumbai Delhi 26 Jan 2017 redeye:no maxprice:5000
Apart from the 3 required parameters, it can take in many other optional parameters. Here, we have mentioned two opt-params: redeye, maxprice.
So we are looking for flights from Mumbai to Delhi for 26th Jan 2017, which are not redeye flights and the maximum ticket price I am willing to pay is 5000 INR.
/flightsearch return Mumbai Delhi '26 Jan 2017' '30Jan 2017' redeye:no
Same command can have various different ways to call. In this case, we are mentioning 5 required arguments: action, from-city, to-city, date-to-go, date-to-come-back
and 1 optional arg: redeyes are rejected.
Example 4 (Alternative to example 3)
/flightsearch Mumbai Delhi '26 Jan 2017' '30Jan 2017' redeye:no return:yes
The /flightsearch command developer could have alternatively made return an optional parameter which is set to 'false' by default. Or simply not have the 'return' parameter and infer it solely from the fact that 2 dates were mentioned.
Depending on how you want to define it, you can choose your way and document it well in your help, so people using your command know how to use it.
/<command-name> <required-arg> ... <optional-arg-name>:<optional-arg-value> ...
There is much more to the command-syntax in yelo on the Advanced command syntax page.
Let us now understand the high level lifecycle of the command.