Passing options and arguments to your commands is very similar to many CLI commands in an *nix environment.
Options are prefixed with a -
and can contain one or more options.
Some options expect a value to be associated with it.
Arguments are string values which aren’t prefixed with -
.
Let’s look at ls
as an example:
ls -r -f KNOWS:out -v 12345
will make a verbose listing of node 12345
's outgoing relationships of type KNOWS
.
The node id, 12345
, is an argument to ls
which tells it to do the listing on that node instead of the current node (see pwd
command).
However a shorter version of this can be written:
ls -rfv KNOWS:out 12345
. Here all three options are written together after a single -
prefix.
Even though f
is in the middle it gets associated with the KNOWS:out
value.
The reason for this is that the ls
command doesn’t expect any values associated with the r
or v
options.
So, it can infer the right values for the rights options.