Currently, this package is completely Context-unaware. Context is, however, the sort of thing the top-level main method may want to establish or control from outside the scope of the subcommand (e.g., for signal-based cancellation, factory installation, etc.).
Some solutions, such as https://godoc.org/github.com/luci/luci-go/common/cli, operate by bolting this support onto subcommands. This results in some pretty wonky code, weird inversions, and the creation (or discarding) of multiple Context.
A better solution would be to have subcommands.Run accept a Context and forward it to its CommandRun.
Currently, this package is completely
Context-unaware.Contextis, however, the sort of thing the top-levelmainmethod may want to establish or control from outside the scope of the subcommand (e.g., for signal-based cancellation, factory installation, etc.).Some solutions, such as https://godoc.org/github.com/luci/luci-go/common/cli, operate by bolting this support onto subcommands. This results in some pretty wonky code, weird inversions, and the creation (or discarding) of multiple
Context.A better solution would be to have subcommands.Run accept a
Contextand forward it to itsCommandRun.