summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-05-02 19:26:41 +0200
committerMatthias Beyer <mail@beyermatthias.de>2018-05-02 20:42:56 +0200
commit191f049ea85a3916538a3477e9858a75a53f64e7 (patch)
treec95db9c7c05e144ed72a1ff7d0078321d7f40406 /bin
parentf618026305758b1e4517224006b4b7ab19fa08d6 (diff)
Add language documentation in commandline help
Diffstat (limited to 'bin')
-rw-r--r--bin/core/imag-ids/src/ui.rs1
-rw-r--r--bin/core/imag-ids/static/language-doc.md51
2 files changed, 52 insertions, 0 deletions
diff --git a/bin/core/imag-ids/src/ui.rs b/bin/core/imag-ids/src/ui.rs
index c4080c8d..61007f14 100644
--- a/bin/core/imag-ids/src/ui.rs
+++ b/bin/core/imag-ids/src/ui.rs
@@ -46,5 +46,6 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.value_names(&["QUERY"])
.help("Query the header of the entries and filter them"))
)
+ .after_help(include_str!("../static/language-doc.md"))
}
diff --git a/bin/core/imag-ids/static/language-doc.md b/bin/core/imag-ids/static/language-doc.md
new file mode 100644
index 00000000..362c5877
--- /dev/null
+++ b/bin/core/imag-ids/static/language-doc.md
@@ -0,0 +1,51 @@
+Language documentation for the imag-ids query language
+======================================================
+
+The query language imag-ids supports is rather simple.
+It can be used to filter the printed imag ids by the values in the header of the
+entries. It has no way to access the content of the entries (yet).
+
+Following is a BNF-like structure shown how the language definition works.
+This definition may change over time, as the language grews more powerful.
+
+```ignore
+query = filter (operator filter)*
+
+filter = unary? ( (function "(" selector ")" ) | selector ) op val
+
+unary = "not"
+
+op =
+ "is" |
+ "in" |
+ "==" |
+ "eq" |
+ "!=" |
+ "neq" |
+ ">=" |
+ "<=" |
+ "<" |
+ ">" |
+ "any" |
+ "all"
+
+val = val | listofval
+
+val = string | int | bool
+listofval = "[" (val ",")* "]"
+
+operator =
+ "or" |
+ "or_not" |
+ "and" |
+ "and_not" |
+ "xor"
+
+function =
+ "length" |
+ "keys" |
+ "values"
+```
+
+A "string" quoted with double-quotes.
+A "val" does not yet support floats.