mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Cobra automatically displays usage messages, and also a gratuitous "Error: [...]" line in some cases, when any error at all occurs running a command. To suppress the usage message, you have to set cmd.SilenceUsage to true. But the code that would do this doesn't have access to it. To address this, we introduce a category of "usage error", implemented with stdlib error wrapping (%w) and use errors.Is to check for it. There's also utility functions to do this checking automatically, or indeed, to handle wrapping of the ctl.SomethingCommand and handle running it with a suitable context and everything. In fact, several of the places we're checking for usage errors, we can never actually report one, but we're checking consistently so that if we want to report usage errors, we can. For instance, server.Start and (dax)server.Start don't ever return usage errors, right now, but we're checking their responses anyway. |
||
|---|---|---|
| .. | ||
| badloader | ||
| featurebase | ||
| featurebase-parse-sql | ||
| pilosa-bench | ||
| roaring-migrate | ||
| slurp | ||
| auth_token.go | ||
| backup.go | ||
| backup_tar.go | ||
| chksum.go | ||
| cli.go | ||
| config.go | ||
| dax.go | ||
| doc.go | ||
| export.go | ||
| export_test.go | ||
| generate_config.go | ||
| import.go | ||
| import_test.go | ||
| keygen.go | ||
| rbf.go | ||
| restore.go | ||
| restore_tar.go | ||
| root.go | ||
| root_test.go | ||
| server.go | ||
| server_test.go | ||