Skip to content

Commit 0aef7da

Browse files
committed
Updated INSTALL.md document for exprtk dependency.
Updated UserManual.md for exprtk attribute
1 parent f70cd8d commit 0aef7da

File tree

2 files changed

+45
-3
lines changed

2 files changed

+45
-3
lines changed

INSTALL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ The following software must be installed on the system for compiling source code
6767
* [Google Logging Library v0.4.0](https://github.com/google/glog/tree/v0.4.0)
6868
* [TinyXML 2 v6.2.0](https://github.com/leethomason/tinyxml2/tree/6.2.0)
6969
* [RapidAssist v0.8.1](https://github.com/end2endzone/RapidAssist/tree/0.8.1)
70+
* [exprtk d312ba9](https://github.com/ArashPartow/exprtk) (downloaded automatically)
7071
* [CMake](http://www.cmake.org/) v3.4.3 (or newer)
7172
* (optional) [Grip (GitHub Readme Instant Preview)](https://github.com/joeyespo/grip) v4.5.2 (or newer)
7273

7374

74-
7575
### Windows Requirements ###
7676

7777
* Microsoft Visual C++ 2010 or newer

UserManual.md

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![ShellAnything logo](docs/ShellAnything-splashscreen.jpg?raw=true)
1+
![ShellAnything logo](docs/ShellAnything-splashscreen.jpg?raw=true)
22

33

44
# Overview #
@@ -18,6 +18,7 @@ This manual includes a description of the system functionalities and capabilitie
1818
* [pattern attribute](#pattern-attribute)
1919
* [exists attribute](#exists-attribute)
2020
* [properties attribute](#properties-attribute)
21+
* [exprtk attribute](#exprtk-attribute)
2122
* [inverse attribute](#inverse-attribute)
2223
* [Icons](#icons)
2324
* [Actions](#actions)
@@ -385,6 +386,42 @@ See [properties](#properties) section for how to define custom properties.
385386

386387

387388

389+
### exprtk attribute: ###
390+
391+
The `exprtk` attribute validates a menu based on a string expression algorithm. The expression must be specified as a mathematical expression and the result must evaluates to `true` or `false` such as `4 == 5` or `10 > 3`.
392+
393+
If `exprtk` attribute is specified, the expression must evaluates to `true` for the validation to be successful. The `exprtk` attribute does not support multiple expressions but logical `and` and `or` operators can be use to group expressions.
394+
395+
If `exprtk` attribute is not specified, then the validation is successful.
396+
397+
The attribute supports the following operators:
398+
* Basic operators: `+`, `-`, `*`, `/`, `%`, `^`
399+
* Equalities & Inequalities: `=`, `==`, `<>`, `!=`, `<`, `<=`, `>`, `>=`
400+
* Logic operators: `and`, `not`, `or`, `xor`, `true`, `false`
401+
* String operators: `in`, `like`, `ilike`, []
402+
403+
Strings may be comprised of any combination of letters, digits special characters including (~!@#$%^&*()[]|=+ ,./?<>;:"``~_) or hexadecimal escaped sequences (eg: \0x30) and must be enclosed with single-quotes.
404+
eg: `'Frankly my dear, \0x49 do n0t give a damn!'`
405+
406+
The `exprtk` attribute allows advanced menu validation. The following table show useful expression examples:
407+
408+
| Use cases | Expression | Meaning |
409+
|------------------------------------------------------------------|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------|
410+
| Test a property for a numeric value | ${value} == 6 | Evaluates to true when property `value` is set to numeric value `6`. |
411+
| Test a property for a string value. | '${name}' == 'John' | Evaluates to true when property `name` is set to string value `John`. |
412+
| Set a menu visible based on how many file are selected | ${selection.count} == 3 | Evaluates to true when user clicked on exactly 3 elements. |
413+
| Set a menu visible based on a state machine | '${myapp.state}' == 'PAUSED' | Evaluates to true when application's state is `PAUSED`. |
414+
| Set a menu *invisible* when it was selected 3 times. | ${myapp.runs} <= 2 | Evaluates to true when property `myapp.runs` is lower or equals to `2`. |
415+
| Set a menu visible by filename length. | '${selection.filename}'[] == 9 | Evaluates to true when user clicked on a file whose filename<br>(including file extension) is exactly 9 characters. |
416+
| Combine expressions with `and` and `or` logic. | ${foo} == 2 or ${bar} >= 5 | Evaluates to true when property `foo` is set to `2` *or*<br>when property `bar` is set to a value greater or equal to `5`. |
417+
| Set a menu visible if user selection contains a specific string. | 'abc' in '${selection.path}' | Evaluates to true when user clicked on a file that contains the string `abc`. |
418+
| Set a menu visible if user selection matches a string pattern. | '${selection.path}' ilike '*.exe' | Evaluates to true when user clicked on a file with `exe` extension. |
419+
420+
**Note:**
421+
The `exprtk` attribute uses the *exprtk library* to parse the expression. For more details and supported expressions, see the exprtk documentation on the [official github page](https://github.com/ArashPartow/exprtk) or the [library website](http://www.partow.net/programming/exprtk/index.html).
422+
423+
424+
388425
### inverse attribute: ###
389426

390427
The `inverse` attribute inverts the logic of one or multiple attributes. For example, to inverse the meaning of the `maxfiles` attribute, set `inverse` attribute to the value `maxfiles`.
@@ -931,6 +968,9 @@ The following table defines the list of dynamic properties and their utility:
931968
| selection.filename.extension | Matches the file extension of the clicked element. |
932969
| selection.drive.letter | Matches the drive letter of the clicked element. For example 'C'. |
933970
| selection.drive.path | Matches the drive path of the clicked element. For example 'C:\'. |
971+
| selection.count | Matches the number of clicked elements (files and directories). |
972+
| selection.files.count | Matches the number of clicked files. |
973+
| selection.directories.count | Matches the number of clicked directories. |
934974

935975
Selection-based properties are encoded in utf-8.
936976

@@ -959,7 +999,9 @@ The system will generates the following property values (note the `\r\n` charact
959999
| selection.drive.letter | C`\r\n`C`\r\n`C |
9601000
| selection.drive.path | C:\\`\r\n`C:\\`\r\n`C:\\ |
9611001

962-
Note that properties `selection.drive.letter` and `selection.drive.path` are empty when all selected files are from a network share.
1002+
Notes:
1003+
* Properties `selection.drive.letter` and `selection.drive.path` are empty when all selected files are from a network share.
1004+
* Properties `selection.count`, `selection.files.count` and `selection.directories.count` are not multi-selection-based properties. They are defined as a single value whether a single or multiple elements are selected.
9631005

9641006

9651007

0 commit comments

Comments
 (0)