Add language documentation in commandline help

This commit is contained in:
Matthias Beyer 2018-05-02 19:26:41 +02:00
parent f618026305
commit 191f049ea8
2 changed files with 52 additions and 0 deletions

View File

@ -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"))
}

View File

@ -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.