Skip to content

CLI/flag package choice and standardization #2455

@fabxc

Description

@fabxc

The proposed amtool (prometheus/alertmanager#636) uses a different CLI/flag package than our other CLI components. This causes friction when using our different tools.

This tool uses cobra/viper, which is the de-facto standard for CLIs in Go nowadays I suppose. It allows nice UX with subcommands and flags specified at those subcommand levels. The flag format is also what one expects in general.
Prometheus, promtool and Alertmanager OTOH are using Go's standard flag package, which is weird at best and limited in functionality. People probably got used to it by now but we probably shouldn't introduce tools with different flag formats etc.

So A) move amtool to stdlib flag (and hack something around for proper subcommands) or B) eventually move Alertmanager, promtool, and Prometheus (2.0+) to cobra.
It would be somewhat disruptive but is probably a saner solution in the long run. For most people it merely means updating their deployment recipes, which they have to anyway for Prometheus 2.0.

@juliusv @brian-brazil @beorn7 @brancz @grobie

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions