Implement capture groups
Capture groups (working title) should allow for the free combination of a commands options, flags and parameters regarding requirement and combination. Take dislocker
for example which may take a full volume encryption key and a volume master key - but only one of them is allowed to be specified.
A capture group might reference these two template_values
and define a method, how they can be combined.
First proposal on the dislocker
example:
{
...
"template": "dislocker %{verbosity} %{bitlocker-partition} %{fvek} %{vmk} -- %{mount-path}",
"capture_groups": { // <--
"key": {
"combination_method": "only-one"
}
},
"template_values": {
"bitlocker-partition": {
"type": "value",
"hint": "Bitlocker partition device",
"default": "$(dislocker-find)"
},
"fvek": {
"type": "value-flag",
"hint": "Full volume encryption key (fvek). Must be obtained manually and dumped to a file.",
"default": "fvek.bin",
"default_state": true,
"usage": "--fvek %",
"capture_group": "key" // <--
},
"mount-path": {
"type": "value",
"hint": "Where to mount the fuse volume to",
"default": "/mnt/fuse"
},
"verbosity": {
"type": "nonvalue-flag",
"hint": "If the command should print verbose logs to stdout",
"value": "-v"
},
"vmk": {
"type": "value-flag",
"hint": "Volume master key (vmk). Must be obtained manually and dumped to a file.",
"default": "vmk.bin",
"usage": "--vmk %",
"capture_group": "key" // <--
}
},
"requires_root": true,
"online_manpage": "https://man.cx/dislocker"
}
Todos
-
Evaluate whether it is more useful to reference the capture_group
within atemplate_value
or the other way around -
Think of more combination methods than only-one
-
Write specification -
Implement in backend -
Migrate/adjust existing preset-database entries
The implementation in the frontend will be tracked in a sperate issue, as soon as this one is closed.