KDAB / knut

Knut is an automation tool for code transformation using scripts.
Other
5 stars 8 forks source link

Add a way to initialize script dialog from command line #32

Open narnaud opened 2 weeks ago

narnaud commented 2 weeks ago

Nowadays, we can run or test a script from the command line using –run or –test.

The one missing piece would be to be able to initialize the dialog from the command line, particularly useful for testing.

Script Dialog use widget name to access data from QML, for example a QLineEdit named fileName will be accessed using data.fileName from QML. We could use a similar mechanism to initialize data. I'm thinking of something like that:

knut --test Script.qml --data `{ fileName:"myfilename"; checkBox: true }`

ie passing either a json fileName or a string that can be interpreted as a json file.

That would mean:

Finally, once everything is done, add a test: