github.com/blend/go-sdk@v1.20220411.3/copyright/option.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 copyright
     9  
    10  // Option is a function that modifies a config.
    11  type Option func(*Copyright)
    12  
    13  // OptVerbose sets if we should show verbose output.
    14  func OptVerbose(verbose bool) Option {
    15  	return func(p *Copyright) {
    16  		p.Config.Verbose = &verbose
    17  	}
    18  }
    19  
    20  // OptDebug sets if we should show debug output.
    21  func OptDebug(debug bool) Option {
    22  	return func(p *Copyright) {
    23  		p.Config.Debug = &debug
    24  	}
    25  }
    26  
    27  // OptExitFirst sets if we should stop after the first failure.
    28  func OptExitFirst(exitFirst bool) Option {
    29  	return func(p *Copyright) {
    30  		p.Config.ExitFirst = &exitFirst
    31  	}
    32  }
    33  
    34  // OptExcludes sets the exclude glob filters.
    35  func OptExcludes(excludeGlobs ...string) Option {
    36  	return func(p *Copyright) {
    37  		p.Config.Excludes = excludeGlobs
    38  	}
    39  }
    40  
    41  // OptIncludeFiles sets the include file glob filters.
    42  func OptIncludeFiles(includeGlobs ...string) Option {
    43  	return func(p *Copyright) {
    44  		p.Config.IncludeFiles = includeGlobs
    45  	}
    46  }
    47  
    48  // OptNoticeBodyTemplate sets the notice body template.
    49  func OptNoticeBodyTemplate(noticeBodyTemplate string) Option {
    50  	return func(p *Copyright) {
    51  		p.Config.NoticeBodyTemplate = noticeBodyTemplate
    52  	}
    53  }
    54  
    55  // OptYear sets the template year.
    56  func OptYear(year int) Option {
    57  	return func(p *Copyright) {
    58  		p.Config.Year = year
    59  	}
    60  }
    61  
    62  // OptCompany sets the template company.
    63  func OptCompany(company string) Option {
    64  	return func(p *Copyright) {
    65  		p.Config.Company = company
    66  	}
    67  }
    68  
    69  // OptLicense sets the template license.
    70  func OptLicense(license string) Option {
    71  	return func(p *Copyright) {
    72  		p.Config.License = license
    73  	}
    74  }
    75  
    76  // OptRestrictions sets the template restrictions.
    77  func OptRestrictions(restrictions string) Option {
    78  	return func(p *Copyright) {
    79  		p.Config.Restrictions = restrictions
    80  	}
    81  }
    82  
    83  // OptConfig sets the config in its entirety.
    84  func OptConfig(cfg Config) Option {
    85  	return func(p *Copyright) {
    86  		p.Config = cfg
    87  	}
    88  }