Skip to content

Subcommands should have first-class support for Context. #4

@danjacques

Description

@danjacques

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions