django-qsessions
django-qsessions copied to clipboard
Ensure cobra command isolation
There's a new class of quality issues in deck (see #331 and #288): cobra Command
s wrongly overwriting or reading values meant for other commands.
I propose that we improve maintainability/modularity of decK by refactoring cobra commands so that:
- each lives in a separate package
- each defines a
struct Config
and has flags bound to a single instance of that struct - implementation of a command is decoupled from cobra, and takes the aforementioned
struct Config
as its input
I did something similar on one of my past projects: https://github.com/weaveworks/wksctl/blob/0184323ebc93df96544a1e3b55c84fbd3d292641/cmd/wksctl/main.go#L47