Mathematical operations in verbs
Is there any utility within broot that enables mathematical operations between verbs? Perhaps, if this is n ot feasible, can we design bash scripts that implement all the background logic but still have a way to show the file changes within broot? Was just curious if this is something that is available to broot users!
Can you please give a few examples of the verbs you'd like ?
Can you please give a few examples of the verbs you'd like ?
Thank you @Canop for entertaining my question!
So, a verb that I currently have in my verbs.hjson file appears as such:
{
name: toggle_depth
shortcut: td
invocation: "toggle_depth {integer}"
internal: ":set_max_depth {integer}"
leave_broot: false
}
However, if we had mathematical operations, I could create a different kind of verb that has real "toggle" features:
{
name: toggle_depth
shortcut: td
invocation: "toggle_depth"
internal: "(-1) * :current_depth_value"
leave_broot: false
}
So hypothetically if your depth value was 3 prior to running the toggle_depth command, running the toggle depth value would result in having a depth value of -3 (which I believe would be evaluated to zero), and running the toggle_depth command yet again would return the value to 3!
Let me know if I need to provide a better example!
If there was a way to put all of th elogic into a bashscript and run it and simply have broot reload with new variable settings, this would also be interesting to me. I wonder if broot --cmd has something that works like this?
Ok, so that there's one example and it makes sense, and we could imagine several solutions.
But I'm not super enthusiastic about defining a solution just for one case which would be better handled with a dedicated :modify_depth {difference}. Let's find other useful cases before.