The first place I’d recommend is the API Documentation, which gives you a good idea of the sorts of things that are possible with the API. I also have a video course that covers the topic in general which might also be of some assistance, though we’re only at week 13 or so.
For your particular purposes, examining the
exec command and how it works should give you some insight. The source for it is in
Default/exec.py, which you can view by using
View Package File from the command palette.
It shows executing an external program and capturing the output, creating an output panel and adding data to it. An output panel is just a
view (as is a file tab), so sending the output to a tab is a fairly trivial enhancement to that.
The navigation that’s found in the
Find in Files results uses the same
line_regex functionality as build systems do, so if the result of the command has an appropriate output you can gain that ability easily as well.
If not, then an event listener listening for the
drag_select command with specific arguments can detect when someone is using the mouse to double click as well (an example of that can be found here)