I started to see strange behavior where flags would merge across
subcommands. I'm not sure if the bug was in our 'append' usage or
in urfave/cli's handling of flag-slices, but this change seems to
fix the problem either way.
* build: add goimports to fmt target to remove unused imports
* feat: update codegen template to support returning raw response body
* feat: add support for gunzip-ing response bodies
* refactor: remove unused piece from codegen return values
* feat: update generated client to include schema-management APIs
* feat: implement interfaces to decode flags and CSV
* feat: implement decoders for different measurement schema column formats
* feat: extend bucket CLI commands to support schema type property
* feat: add CLI commands to manage measurement schema
* test: add unit tests for bucket schema create, update and list commands
This commit represents a few experiments of features I've used in Cobra
1. Uses cli.GenericFlag to encapsulate parsing and validation of flag
values at parse time. This removes the burden from the individual
CLI commands to parse and validate args and options.
2. Add influxid.ID that may be used by any flag that requires an
Influx ID. influxid.ID parses and validates string value is a valid
ID, removing this burden from individual commands and ensuring valid
values before the command actions begins.
3. Binds cli.Flags directly to params structures to directly capture
the values when parsing flags.
4. Moves from global state to local builder functions for the majority
of the commands. This allows the commands to bind to flag variables
reducing the repeated ctx.String(), ctx.Int(), etc
5. Leverages the BeforeFunc to create middleware and inject the CLI and
API client into commands, saving the repeated boilerplate across
all of the instantiated commands. This is extensible, so additional
middleware can be appends using the middleware.WithBeforeFns
* Use `[]byte` for generated request bodies when the source schema has `format: byte`
* Gzip-compress request bodies when `Content-Encoding: gzip` is set
* Require that all models returned as error conditions in our API implement the `error` interface
* Move the implementation for `api.HealthCheck` out of `ping.go` and into `api/error.go`
Co-authored-by: William Baker <55118525+wbaker85@users.noreply.github.com>
* build: use deepmap/oapi-codegen to generate an HTTP client
* feat: add global CLI options
* feat: load local config to find host and token
* feat: implement ping command
* test: add unit tests for ping command
* docs: fill in README
* feat: initial setup of CLI, with help + version commands
* build: add linters and Makefile
* build: add initial CircleCI workflow