0

I would like to create command-line tool like git, go or aws in which we will pass some sub-commands to the main command and the last sub-command could also have some flags. Some examples are:

git add <file>
go build <file>
aws s3 cp --recursive <src> <dest>

Here are some examples of my hypothetical tool:

mytool cmd1
mytool cmd2 -f <path>
mytool cmd3 -f1 -f2 value --flag3 <path>

I know we can use the fmt package for defining and parsing flags, but I don't know if this package gives me the feature I described above or not. I was wondering if there is any built-in package for doing so?

moorara
  • 3,897
  • 10
  • 47
  • 60

1 Answers1

0

just do a simple search on google and you can find anything

rkmax
  • 17,633
  • 23
  • 91
  • 176
  • Before trying third-party packages, I'd like to first see if there is an easy way to do this with Go build-in libs. – moorara Jul 15 '16 at 03:44