github.com/cloud-foundations/dominator@v0.0.0-20221004181915-6e4fee580046/lib/flags/commands/api.go (about)

     1  package commands
     2  
     3  import (
     4  	"io"
     5  
     6  	"github.com/Cloud-Foundations/Dominator/lib/log"
     7  )
     8  
     9  type CommandFunc func([]string, log.DebugLogger) error
    10  
    11  type Command struct {
    12  	Command string
    13  	Args    string
    14  	MinArgs int
    15  	MaxArgs int
    16  	CmdFunc CommandFunc
    17  }
    18  
    19  func PrintCommands(writer io.Writer, commands []Command) {
    20  	printCommands(writer, commands)
    21  }
    22  
    23  func RunCommands(commands []Command, printUsage func(),
    24  	logger log.DebugLogger) int {
    25  	return runCommands(commands, printUsage, logger)
    26  }