github.com/blend/go-sdk@v1.20220411.3/codeowners/config.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package codeowners 9 10 // Config are the configuration options for the utility. 11 type Config struct { 12 // Path is the owners file path (typically `.github/CODEOWNERS`) 13 Path string `yaml:"path"` 14 // GithubURL is the url of the github instance to communicate with. 15 GithubURL string `yaml:"githubURL"` 16 // GithubToken is the authorization token used to communicate with github. 17 GithubToken string `yaml:"githubToken"` 18 19 // Quiet controls whether output is suppressed. 20 Quiet *bool `yaml:"quiet"` 21 // Verbose controls whether verbose output is shown. 22 Verbose *bool `yaml:"verbose"` 23 // Debug controls whether debug output is shown. 24 Debug *bool `yaml:"debug"` 25 } 26 27 // PathOrDefault is the path for the codeowners file or a default. 28 func (c Config) PathOrDefault() string { 29 if c.Path != "" { 30 return c.Path 31 } 32 return DefaultPath 33 } 34 35 // GithubURLOrDefault returns a value or a default. 36 func (c Config) GithubURLOrDefault() string { 37 if c.GithubURL != "" { 38 return c.GithubURL 39 } 40 return DefaultGithubURL 41 } 42 43 // QuietOrDefault returns a value or a default. 44 func (c Config) QuietOrDefault() bool { 45 if c.Quiet != nil { 46 return *c.Quiet 47 } 48 return false 49 } 50 51 // VerboseOrDefault returns a value or a default. 52 func (c Config) VerboseOrDefault() bool { 53 if c.Verbose != nil { 54 return *c.Verbose 55 } 56 return false 57 } 58 59 // DebugOrDefault returns a value or a default. 60 func (c Config) DebugOrDefault() bool { 61 if c.Debug != nil { 62 return *c.Debug 63 } 64 return false 65 }