diff options
author | Yousong Zhou <yszhou4tech@gmail.com> | 2014-12-17 00:15:37 +0300 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-12-22 17:46:35 +0300 |
commit | fecaf2f5f66f8cb5598e55d493e4721554c5dcd5 (patch) | |
tree | 93a936f99931a57046e474a265c97d9626df7ff0 /examples/json_script-example.json | |
parent | 13b5c1d4ca488575ee3dd4726b669f768fad8ffa (diff) |
examples: add example code for json_script.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Diffstat (limited to 'examples/json_script-example.json')
-rw-r--r-- | examples/json_script-example.json | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/examples/json_script-example.json b/examples/json_script-example.json new file mode 100644 index 0000000..45636b7 --- /dev/null +++ b/examples/json_script-example.json @@ -0,0 +1,33 @@ +[ + [ "exec", "%EXECVAR%", "/%%/" ], + [ "if", + [ "eq", "EQVAR", "eqval" ], + [ "exec_if", "%VAR%", "%%", "jk" ] + ], + [ "case", "CASEVAR", { + "caseval0": ["cmd_case_0", "cmd_case_arg0", "case_cmd_arg1"], + "caseval1": ["cmd_case_1", "cmd_case_arg0", "case_cmd_arg1"] + } ], + + [ "if", + [ "and", [ "eq", "EQVAR", "eqval" ], + [ "has", "HASVAR" ], + [ "regex", "REGEXVAR0", "regexval" ], + [ "regex", "REGEXVAR1", [ "regexval10", "regexval11" ] ], + [ "not", [ "eq", "NOTEQVAR", "noteqval" ] ] ], + [ "exec_if_and", "%ANDVAR%" ] + ], + + [ "if", + [ "or", [ "eq", "EQVAR", "eqval" ], + [ "has", "HASVAR" ], + [ "regex", "REGEXVAR0", "regexval" ], + [ "regex", "REGEXVAR1", [ "regexval10", "regexval11" ] ], + [ "not", [ "eq", "NOTEQVAR", "noteqval" ] ] ], + [ "exec_if_or", "%ORVAR%" ] + ], + + [ "return", "foobar" ], + + [ "exec_non_reachable", "Arghhh" ] +] |