From f097580b90930a7bb36bef69d339821af27dbb7c Mon Sep 17 00:00:00 2001 From: PyroScope Project Date: Wed, 15 Mar 2017 23:26:23 +0100 Subject: [PATCH] "if" example --- COMMAND-Conditional.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 COMMAND-Conditional.md diff --git a/COMMAND-Conditional.md b/COMMAND-Conditional.md new file mode 100644 index 0000000..c4879ca --- /dev/null +++ b/COMMAND-Conditional.md @@ -0,0 +1,11 @@ +**TODO** clean this up, for now collect snippets + +There are the `if` and `branch` commands to implement conditional execution of other commands. The difference is that `if` takes an expression for the condition, while `branch` takes a command name (and evaluates it). + +The following example shows a method definition, using `if` with `(…)` syntax for its arguments: + +```ini +# COMMAND: Return path to item data (never empty, unlike `d.base_path`) +method.insert = d.data_path, simple,\ + "if=(d.is_multi_file), (cat, (d.directory)), (cat, (d.directory), /, (d.name))" +```