Advanced Command line syntax

1. Brace yourselves

To club multiple words into a single input token, we generally use single quotes '' or double quotes "". But working with many quotes in nested situations can very quickly become a nightmare.

Hence, we introduced {}. Braces act like quotes, in that, if we encounter one in the incoming line, we will assign the next required argument to it and it cleanly also tells us where it ends. You can also have nested braces {/blah blah {bluh blah}}

So use braces for your own visual sanity and to help yelo decode your line efficiently.

Checkout the following example to create two horizontally placed blue colored helper buttons to get the hackernews top and new news items.

Using quotes:

/horizontal_list "/button '/hackernews' 'Hackernews Top' color:blue" "/button color:blue '/hackernews new' 'Hackernews New'"

Using braces:

/horizontal_list {/button /hackernews {Hackernews Top} color:blue} {/button color:blue {/hackernews new} {Hackernews New}}

Note: Currently, braces are not supported as values for optional args (named arguments). This will be supported soon.

2. List inputs

Whenever a list input is expected by your command (pathway), we basically choose a greedy approach to get the elements in the list and send that list to you. We try to fetch as many tokens we can fit and consider each as one element of the list.

In the real world, it might lead to some unintended items getting added or removed to the list which can create errors.

To help remedy this problem, we introduce [] syntax.

If we are expecting a list as the next argument for a pathway and we encounter [...] then we treat that as the list.

List items can be space separated. Quotes and braces are honored:

/pqr [1 2 3 pqr "qwe rty" {hello world}]
  => creates ["1", "2", "3", "pqr", "qwe rty", "hello world"]

If there is a comma in the list, we treat comma as the delimiter instead of spaces.

/pqr [123, qwe rty, hey man what 'is going on', also {true} that]
  => ["123", "qwe rty", "hey man what 'is going on'", "also {true} that"]

Note: Comma takes precedence, irrespective of braces or quoted string present.

/pqr xyz:req:/city abc:req:/positiveinteger date:opt:/datetime:1,3-5

/pqr a:/1word b:/1word
/pqr hello world
a = "hello"
b = "world"

/pqr a:/str
/pqr hello world
a = "hello world"

/pqr z:/listtype meta:/positiveinteger
/pqr 123 3434 4545 333
/pqr [123 3434 4545 333]
/pqr [123,3434,4545,333]
/pqr [123, 3434, 4545, 333]
/pqr 123,3434,4545,333
/pqr {123,3434,4545,333}  # just a redundant way to write the above thing
z = [123, 3434, 4545, 333]


To get old prices of the stock:
/nse stockname:req:/str date:req:/date
/nse SBIN 26 jan 2016
stockname = "SBIN"
date = 26-01-2016


/nse stockname:req:/str date:opt:/date
/nse "CAN FIN HOMES LIMITED" "23 june 2016"
/nse "CAN FIN HOMES LIMITED" 23 june 2016
/nse CAN FIN HOMES LIMITED "23 june 2016"
stockname = "CAN FIN HOMES LIMITED"
date = 23-06-2016

Instead of double-quote a single-quote can be used too.
Quotes have a way of having a lot of problem with escaping when you have to go many levels deep. So we can also use {} instead of quotes.


Example:
/nse stockname:req:/str date:opt:/date
/nse {ashok leyland} {12 aug 2015}
/nse ashok leyland {12 aug 2014}
/nse {ashok leyland} 12 aug 2014


/nse stockname:req:/str date:opt:/date
/nse stockname::required::/str date::optional::/date


/nse canfin homes ltd 26 jan 2016
Ideally, this should start matching from back to get the date and everything else is treated as the string.
But, until we are sure we have this power, we will throw an error saying, it didn't match anything.


/cricket action:up|n|next|upcoming
/cricket next
action = next


/xyz abc:req:r''

results matching ""

    No results matching ""