REPL (Interactive Shell)

Start REPL

The command line has to end with the period, ‘.’, full stop.

REPL supports GNU readline, you can edit the command line and its history such as bash. The history is saved in ~/.faasshell_history.

REPL console will be implemented in Web Browser later (TODO).

$ git clone https://github.com/NaohiroTamura/faasshell

$ cd faasshell

$ src/faasshell_repl.pl
faasshell> help.
----------------------------------------------------------------------
global variable: begin with a lower case letter
local  variable: begin with a upper case letter
JSON   value   : _{key:"string", number:1, list:["a","b"]}
----------------------------------------------------------------------
debug(on)      : display debug message
debug(off)     : suppress debug message
startsm(Input) : start state machine and inject Input data
endsm(Output)  : end state machine and get Output data, it is optional
set(x,y)       : set a value 'y' to a global variable 'x'
unset(x)       : unset a global variable 'x'
unsetall       : unset all global variables
getall         : get all values of the global variables
$x             : refer to a value of the global variable 'x'
#x             : evaluate a value of the global variable 'x'
X=Y            : substitute a value 'Y' to the local variable 'X'
----------------------------------------------------------------------

Interaction

Create State

faasshell> set(hello, task('HelloWorld',"frn:wsk:functions:::function:hello",[])).
Output=task(HelloWorld,frn:wsk:functions:::function:hello,[])

faasshell> set(update_arg, pass('UpdateArg',[result_path('$.ifttt.value1'),input_path('$.payload'),output_path('$.ifttt')])).
Output=pass(UpdateArg,[result_path($.ifttt.value1),input_path($.payload),output_path($.ifttt)])

faasshell> set(save_result, task('SaveResult',"frn:ifttt:webhooks:::function:save_result",[])).
Output=task(SaveResult,frn:ifttt:webhooks:::function:save_result,[])

faasshell>

Execute State Machine

faasshell> startsm(_{name:"Repl"}), #hello, #update_arg, #save_result.
Output=Congratulations! You've fired the save_result event

faasshell>

End REPL

Push Control-D twice. The debug prompt should be hidden in production (TODO).

faasshell> Control-D
faasshell debug> Control-D