3 ms·
I've recently been writing command lines tool (for internal use mostly) and wrote them in bash because running other command line tools and checking their exit
by Timothee 12y ago
I've recently been writing command lines tool (for internal use mostly) and wrote them in bash because running other command line tools and checking their exit codes is simpler in bash than in Python for example. Problems start to come up when I have to deal with APIs that return or expect JSON.
From what you're writing it seems that it might be worth checking Go out for that. Would you happen to have pointers for using Go for that purpose?
- stormbrew 12y agoInterestingly, the tool that turned me on to using go as a commandline tool builder was a little thing called jq [1] that's a huge huge help in dealing with json from bash scripts. I have no specific pointers, though, so I'm glad some other people jumped in. [1] http://stedolan.github.io/jq/ http://stedolan.github.io/jq/
- motter 12y agoIt's certainly worth looking at the standard flag package (http://golang.org/pkg/flag/ http://golang.org/pkg/flag/) if you just need flag parsing. I've also heard good things about https://github.com/spf13/cobra https://github.com/spf13/cobra and https://github.com/codegangsta/cli https://github.com/codegangsta/cli.
- xkarga00 12y agoRead this as well: http://blog.golang.org/json-and-go http://blog.golang.org/json-and-go