subcommands icon indicating copy to clipboard operation
subcommands copied to clipboard

Subcommands should have first-class support for Context.

Open danjacques opened this issue 8 years ago • 1 comments

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.

danjacques avatar Apr 06 '17 22:04 danjacques

ok

maruel avatar Apr 11 '17 23:04 maruel