-
Notifications
You must be signed in to change notification settings - Fork 2
parms with
Parameters to functions are automatically bound from the with if not given on the command. For instance cli/msg has a python function signature of cli/msg(msg).
If a value for msg, the parameter, can be found in the current with path, that value will be used, if something else isn't given.
So doing this works,
cli/msg "Hello World"
and so does this.
with mymsg
'
:msg "Hello World"
cli/msgbox
When using functions in this way, it can be helpful to initialize a path with a function's signature map. Especially for more complicated functions.
This can be done with -get-sig-map. It's not particularly useful, here, But it can be.
help cli/msg
SPR Help
=============================================
cli/msg(msg)
Signature Map: {'msg': None}
----------------
Display a message on the cli and wait for input.
SPR:> with mymsg
/mymsg
-------------------------
Is Empty.
SPR:> -set-sig-map cli/msg
SPR:> with
/mymsg
-------------------------
msg
SPR:> show
/mymsg
msg: null
SPR:> '
YAML...>msg: Hello World
YAML...>
SPR:> show
/mymsg
msg: Hello World
Here is some examples to show how things are working.
# stupid simple, give a message dialog window.
SPR:> help cli/msg
SPR Help
=============================================
cli/msg(msg)
Signature Map: {'msg': None}
----------------
Display a simple message box, with either
the msg or the text located at msg if it begins with a /..
It's only parameter is msg.
Here is basic usage.
SPR:> cli/msg "Hello World"
"Hello World"
Press any key to continue;
SPR:> set /foo/mymsg "Hello World"
"Hello World"
SPR:> ls /foo
mymsg
SPR:> show /foo
/foo
mymsg: '"Hello World"'
SPR:> cli/msg /foo/mymsg
"Hello World"
Press any key to continue;
And now by using with it's a little easier and more readable.
Everything is still there. So we go back. add msg, look at it, and call cli/msg with it.
SPR:> with /foo
/foo
-------------------------
Is Empty
SPR:> '
YAML...>msg: This is another message to say hello.
YAML...>
SPR:> with
/foo
-------------------------
mymsg
msg
SPR:> ls /foo
mymsg
msg
SPR:> show /foo
/foo
msg: This is another message to say hello.
mymsg: '"Hello World"'
SPR:> cli/msg
This is another message to say hello.
Press any key to continue;
SPR:> with
/foo
-------------------------
mymsg
msg
Really, all of that amounts to this. Blank lines are important.
with /foo
'
msg: This is another message to say hello.
cli/msg