github.com/linuxboot/fiano@v1.2.0/pkg/intel/metadata/common/pretty/options.go (about)

     1  // Copyright 2017-2021 the LinuxBoot Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package pretty
     6  
     7  type Option interface {
     8  	apply(*config)
     9  }
    10  
    11  type OptionOmitKeySignature bool
    12  
    13  func (opt OptionOmitKeySignature) apply(cfg *config) {
    14  	cfg.OmitKeySignature = bool(opt)
    15  }
    16  
    17  type config struct {
    18  	OmitKeySignature bool
    19  }
    20  
    21  func getConfig(opts []Option) config {
    22  	var cfg config
    23  	for _, opt := range opts {
    24  		opt.apply(&cfg)
    25  	}
    26  	return cfg
    27  }