Command Line Interpreter Func object?

Using CLI ScriptMode is handy for testing code snippets but unless I have missed something there is no equivalent of the ClickData or ScriptCommandData object available in a ScriptMode window and therefore no access to a Func object.

My script template starts like this

function OnClick(clickData) {
    var cmd = clickData.func.command;
    var tab = clickData.func.sourcetab;
    cmd.deselect = false;
}

For the CLI I rarely need more than

var cmd = DOpus.Create().Command();
var tab = DOpus.listers.lastactive.activetab;

What else from the Func object do you use?

My script template and CLI base code looks almost identical to yours @lxp and I had never had any reason to question DOpus.listers.lastactive.activetab until I happened across this yesterday which prompted me to ask the question.

The CLI isn't part of a lister, and is only for ad-hoc testing of script code, so listers.lastactive is fine to use there.

OnClick handlers in buttons and hotkeys should generally use the supplied command/dialog/lister/tab/etc. objects rather than creating new ones or hunting around for them via global properties. (There are exceptions, of course. And global hotkeys can be run in situations where no lister exists.)