Documentation

Overview

    Package input provides input parsing utilities for the Inertia CLI

    Index

    Constants

    This section is empty.

    Variables

    View Source
    var (
    	// ErrEmptyInput is returned on empty imputs - toggle with AllowEmpty
    	ErrEmptyInput = errors.New("empty input")
    	// ErrInvalidInput is returned on disallowed inputs - toggle with AllowInvalid
    	ErrInvalidInput = errors.New("invalid input")
    )

    Functions

    func CatchSigterm

    func CatchSigterm(cancelFunc func())

      CatchSigterm listens in the background for some kind of interrupt and calls the given cancelFunc as necessary

      Types

      type PromptConfig

      type PromptConfig struct {
      	AllowEmpty   bool
      	AllowInvalid bool
      }

        PromptConfig offers prompt configuration

        type PromptInteraction

        type PromptInteraction struct {
        	// contains filtered or unexported fields
        }

          PromptInteraction is a builder for interactions - use .PromptX followed by .GetX

          func NewPrompt

          func NewPrompt(conf *PromptConfig) *PromptInteraction

            NewPrompt instantiates a new prompt interaction on standard in

            func NewPromptOnInput

            func NewPromptOnInput(in io.Reader, conf *PromptConfig) *PromptInteraction

              NewPromptOnInput instantiates a new prompt on specified input

              func (*PromptInteraction) GetBool

              func (p *PromptInteraction) GetBool() (bool, error)

                GetBool retrieves a boolean response based on "y" or "yes"

                func (*PromptInteraction) GetString

                func (p *PromptInteraction) GetString() (string, error)

                  GetString retreives the raw string response from the prompt

                  func (*PromptInteraction) Prompt

                  func (p *PromptInteraction) Prompt(query ...interface{}) *PromptInteraction

                    Prompt prints the given query and reads the response

                    func (*PromptInteraction) PromptFromList

                    func (p *PromptInteraction) PromptFromList(optionName string, options []string) *PromptInteraction

                      PromptFromList creates a choose-one-from-x prompt

                      func (*PromptInteraction) Promptf

                      func (p *PromptInteraction) Promptf(query string, args ...interface{}) *PromptInteraction

                        Promptf prints the given query and reads the response

                        Source Files