Here's how the hk app does it: https://github.com/heroku/hk/blob/master/main.go#L120
Basically it reads the arguments to the executable and matches them against a built-in list of supported commands and dispatches appropriately.
node.js - http://nodejs.org/docs/latest/api/process.html#process_proce...
python - http://docs.python.org/2/library/sys.html
ruby - http://www.ruby-doc.org/core-2.0.0/ARGF.html#method-i-argv
I use this route in one of my projects https://github.com/walle/gas/blob/development/bin/gas
Basically, all executables in your PATH that conforms to a naming convention is a plugin. If a match is found it's run.
So in my case you can call both ´$ gas list´ and ´$ gas-list´.
I don't know if this is the best way to do it, my inspiration was how git commands work.
2. Put it in your PATH.
3. Profit.
The long version is more complicated than that, but you need to tell more details first.
If only it would be ported to more languages...
Note: It doesn't have to be built with Golang..
Thanks
Edit: Thanks for the replies :)
Note: It doesn't have to be just Go, I'm just asking in general..
I would basically like to create a scaffold generator. So, when I do
I would like a file named test.html (or something) generated..Thanks again..