Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option []Options
Option implements method that helps in identifying if input is present in predefined list.
type Options ¶
type Options struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` Short string `json:"short,omitempty" yaml:"short,omitempty"` }
Options that should be considered while configuring the shell reader. ex: yes/no (name) (y/n) (short) To get about value the options would look like: []Options{{Name: yes,Short: y}, {Name: no,Short: n}}.
type ReadConfig ¶
type ReadConfig struct { ShellName string `json:"shell_name,omitempty" yaml:"shell_name,omitempty"` ShellMessage string `json:"shell_message,omitempty" yaml:"shell_message,omitempty"` InputOptions []Options `json:"inputs,omitempty" yaml:"inputs,omitempty"` // contains filtered or unexported fields }
ReadConfig holds the necessary inputs that is required by Reader.
func NewReadConfig ¶
func NewReadConfig(name, message string, options []Options, logger *logrus.Logger) *ReadConfig
NewReadConfig returns new instance of ReadConfig.
func (*ReadConfig) Reader ¶
func (cfg *ReadConfig) Reader() (bool, Options)
Reader reads the inputs from the shell input and matches against the inputs set. This would help one in designing the CLI commands that interactively takes input from end user ang validate them. For example: taking inputs such as yes or no from end user.