github.com/linuxboot/fiano@v1.2.0/pkg/visitors/comment.go (about)

     1  // Copyright 2018 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 visitors
     6  
     7  import (
     8  	"fmt"
     9  	"io"
    10  	"os"
    11  
    12  	"github.com/linuxboot/fiano/pkg/uefi"
    13  )
    14  
    15  // Comment holds the io.Writer and args for a comment
    16  type Comment struct {
    17  	W io.Writer
    18  	s string
    19  }
    20  
    21  // Run wraps Visit and performs some setup and teardown tasks.
    22  func (v *Comment) Run(f uefi.Firmware) error {
    23  	fmt.Fprintf(v.W, "%s\n", v.s)
    24  	return nil
    25  }
    26  
    27  // Visit applies the Comment visitor to any Firmware type.
    28  func (v *Comment) Visit(f uefi.Firmware) error {
    29  	return nil
    30  }
    31  
    32  func init() {
    33  	RegisterCLI("comment", "Print one arg", 1, func(args []string) (uefi.Visitor, error) {
    34  		return &Comment{W: os.Stdout, s: args[0]}, nil
    35  	})
    36  }