github.com/Benchkram/bob@v0.0.0-20220321080157-7c8f3876e225/bob/options.go (about)

     1  package bob
     2  
     3  import (
     4  	"github.com/Benchkram/bob/pkg/buildinfostore"
     5  	"github.com/Benchkram/bob/pkg/store"
     6  )
     7  
     8  type Option func(b *B)
     9  
    10  func WithDir(dir string) Option {
    11  	return func(b *B) {
    12  		b.dir = dir
    13  	}
    14  }
    15  
    16  // WithRequireBobConfig forces bob to read the configuration
    17  // from `.bob/config`. Currently only used by `bob clone` and `bob git ...
    18  func WithRequireBobConfig() Option {
    19  	return func(b *B) {
    20  		b.readConfig = true
    21  	}
    22  }
    23  
    24  func WithFilestore(store store.Store) Option {
    25  	return func(b *B) {
    26  		b.local = store
    27  	}
    28  }
    29  
    30  func WithBuildinfoStore(store buildinfostore.Store) Option {
    31  	return func(b *B) {
    32  		b.buildInfoStore = store
    33  	}
    34  }
    35  
    36  func WithCachingEnabled(enabled bool) Option {
    37  	return func(b *B) {
    38  		b.enableCaching = enabled
    39  	}
    40  }