hofstadter-io / cuetils

CLI and library for diff, patch, and ETL operations on CUE, JSON, and Yaml
BSD 3-Clause "New" or "Revised" License
78 stars 6 forks source link

Don't use flags directly in structural Go funcs #9

Closed verdverm closed 2 years ago

verdverm commented 2 years ago

Flagpoles should be passed in rather than used directly. Would like to avoid having an extra config object since the flags are in their own package anyhow. Is this an anti-pattern?

Support passing nil to the pkg funcs and filling in as necessary? How to handle defaults? Viper handles this via the bind that happens in the CLI, maybe modify hofmod-cli to create a DefaultFlagpole var?

verdverm commented 2 years ago

closed in https://github.com/hofstadter-io/cuetils/commit/b38d044c3ca228fea60be3ffbae0f10032d6b1cd