cmd/svcat only contains the root svcat commands, but not the child commands.
pkg/resource contains both cobra child commands, wrapper functions around the svcat client, and business logic for commands.
pkg/output contains command output formatters.
pkg/traverse contain more wrapper functions around the svcat client.
This causes a few awkward points:
Circular dependencies in our resource packages when attempting to reuse wrapper functions, like retrieving a resource by its external name.
Splitting up of wrappers across packages without a clear boundary other than "traversal" of the hierarchy.
Output doesn't stand on its own at all, its tightly coupled to the svcat commands.
Our wrappers aren't exposed, and pull in unexpected dependencies, like cobra.
I suggest that we shuffle our packages like so:
cmd/svcat - all of the cli concerns, including output/formatting. Our dependency on cobra should be limited to this package only.
pkg/svcat - svcat business logic (like provision or sync). This is suitable for someone to pull in if they wanted to use svcat as a library instead of a cli.
pkg/client - I don't care about the name; the intent is to contain our hand crafted wrappers around the generated service catalog client.
Right now our packages have mixed concerns:
This causes a few awkward points:
I suggest that we shuffle our packages like so: