peterbourgon / ff

Flags-first package for configuration
Apache License 2.0
1.34k stars 59 forks source link

Expand Command with an Examples field #104

Closed mfridman closed 1 year ago

mfridman commented 1 year ago

What are your thoughts on adding an Example string field to the top-level Command struct? I found it useful to include copy/pasteable examples for each command, e.g.,

$ goose up --help

The up command runs all available migrations.

USAGE
  goose up [flags]

FLAGS
  ...

EXAMPLES
  $ goose up --dbstring="postgres://user:password@localhost:5432/dbname" --dir=db/migrations
  $ GOOSE_DIR=./examples/sql-migrations GOOSE_DBSTRING="sqlite:./test.db" goose up-to 3

Granted, I can solve this with a custom helper function, but figured I'd open an issue to see if there was interest in having a well-defined field within the package itself.

peterbourgon commented 1 year ago

IMO not generalizable in this way, and best left to a custom usage func when necessary. But, thank you for the idea!