Rename Exclude -> Blacklist
This commit is contained in:
parent
c65c1f6a2c
commit
16b6a2b176
10 changed files with 40 additions and 41 deletions
12
main.go
12
main.go
|
@ -63,8 +63,8 @@ func main() {
|
|||
rootCmd.PersistentFlags().StringP("output", "o", "models", "The name of the folder to output to")
|
||||
rootCmd.PersistentFlags().StringP("schema", "s", "public", "The name of your database schema, for databases that support real schemas")
|
||||
rootCmd.PersistentFlags().StringP("pkgname", "p", "models", "The name you wish to assign to your generated package")
|
||||
rootCmd.PersistentFlags().StringP("basedir", "b", "", "The base directory has the templates and templates_test folders")
|
||||
rootCmd.PersistentFlags().StringSliceP("exclude", "x", nil, "Tables to be excluded from the generated package")
|
||||
rootCmd.PersistentFlags().StringP("basedir", "", "", "The base directory has the templates and templates_test folders")
|
||||
rootCmd.PersistentFlags().StringSliceP("blacklist", "b", nil, "Do not include these tables in your generated package")
|
||||
rootCmd.PersistentFlags().StringSliceP("whitelist", "w", nil, "Only include these tables in your generated package")
|
||||
rootCmd.PersistentFlags().StringSliceP("tag", "t", nil, "Struct tags to be included on your models in addition to json, yaml, toml")
|
||||
rootCmd.PersistentFlags().BoolP("debug", "d", false, "Debug mode prints stack traces on error")
|
||||
|
@ -118,12 +118,12 @@ func preRun(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
|
||||
// BUG: https://github.com/spf13/viper/issues/200
|
||||
// Look up the value of ExcludeTables & Tags directly from PFlags in Cobra if we
|
||||
// Look up the value of blacklist, whitelist & tags directly from PFlags in Cobra if we
|
||||
// detect a malformed value coming out of viper.
|
||||
// Once the bug is fixed we'll be able to move this into the init above
|
||||
cmdConfig.ExcludeTables = viper.GetStringSlice("exclude")
|
||||
if len(cmdConfig.ExcludeTables) == 1 && strings.HasPrefix(cmdConfig.ExcludeTables[0], "[") {
|
||||
cmdConfig.ExcludeTables, err = cmd.PersistentFlags().GetStringSlice("exclude")
|
||||
cmdConfig.BlacklistTables = viper.GetStringSlice("blacklist")
|
||||
if len(cmdConfig.BlacklistTables) == 1 && strings.HasPrefix(cmdConfig.BlacklistTables[0], "[") {
|
||||
cmdConfig.BlacklistTables, err = cmd.PersistentFlags().GetStringSlice("blacklist")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue