Post · 2 min read· pp. 168–169

Subcommand handling in Go

A few days ago I was working on an example program for the sftp package and found I needed to implement subcommand handling.

https://twitter.com/davecheney/status/397686194462396416

The response was fantastic, no less than 12 different packages. I haven’t had the chance to review any of the packages in detail, but I wanted to list them here as thanks to the great #golang community,

@davecheney you mean like this? https://t.co/P8azKyiEU7 that’s my favorite package for commandline options and subcommand parsing.

— Andreas Krennmair (@der_ak) November 5, 2013

@davecheney The organization of cmd/go is simple and scalable. Otherwise, https://t.co/cYjMv22ID1 and https://t.co/b4MriVpeC7

— Revel Framework (@revelframework) November 5, 2013

@davecheney http://t.co/M0sqUPU7tH has gained some popularity as of late. It does a pretty good job with subcommands

— Jeremy Saenz (@thecodegangsta) November 5, 2013

https://twitter.com/bketelsen/status/398152055107624961

@davecheney It's a little much when you only want subcommands, but it's still my most-used, self-written package: https://t.co/1BIy7YbMQU

— Surma (@DasSurma) November 5, 2013

@davecheney Googling yields https://t.co/6XdgCKoo6T

— Daniel Morsing (@DanielMorsing) November 5, 2013

@davecheney My friend @tobstarr made this one: https://t.co/0qpbTQ6V8p

— Mathias Lafeldt (@mlafeldt) November 5, 2013

@davecheney OMG perfect timing. I just started extracting Serf and Packers CLI: http://t.co/WyxLuTg624

— Mitchell Hashimoto (@mitchellh) November 5, 2013

@davecheney in my project i use this simple technique https://t.co/OR6kQuKPXL

— Leonid Bugaev (@buger) November 5, 2013