Konubinix' opinionated web of thoughts

Clk Path vs Click Context Path


clk path vs click context path

Some might say that the click context already provide a path, that in a lot of case is similar to clk path.

Yet, we had to create another notion to deal with those remaining cases, that are the heart of clk.

click context are execution contexts. The fact that they also deal with giving some data about the parsing initially made us think that they were parsing context.

For example, imagine you are calling a command “3d print” that needs to call another command “3d calibrate”. The standard way of doing so in click would be to ctx.invoke(calibrate). Doing so creates a nested context in the 3d > print one. This means that when invoking calibrate, the “path” would be 3d > print > calibrate.

Also, imagining you create the following alias:

clk alias set 3d.calibnprint 3d.calib , 3d.print

Then, calling the alias puts us in the context 3d > calibnprint and the call to the aliased commands would put us in the contexts 3d.calibnprint.calib and 3d.calibnprint.print.

see clk.core.run vs click.context.invoke for more information.

Notes linking here