input

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package input manages interaction with the user via input/output.

Index

Constants

This section is empty.

Variables

View Source
var InitSurvey = []*survey.Question{
	{
		Name:     "Name",
		Prompt:   &survey.Input{Message: "Project name"},
		Validate: survey.Required,
	},
	{
		Name: "Type",
		Prompt: &survey.Select{Message: "Project type",
			Options: []string{
				manifest.Executable.String(),
				manifest.Library.String(),
			},
		},
	},
	{
		Name:   "Description",
		Prompt: &survey.Input{Message: "Project description"},
	},
	{
		Name: "Version",
		Prompt: &survey.Input{
			Message: "Project version",
			Default: "1.0.0",
		},
		Validate: func(ans interface{}) error {
			_, err := semver.NewVersion(ans.(string))
			return err
		},
		Transform: func(ans interface{}) (newAns interface{}) {
			v, _ := semver.NewVersion(ans.(string))
			return v.String()
		},
	},
	{
		Name: "License",
		Prompt: &survey.Input{
			Message: "Project license",
			Default: "UNLICENSED",
			Help:    "You can read about code licenses on https://choosealicense.com/",
		},
	},
}

InitSurvey is the definition of the user interaction happening in the init command to choose project parameters.

View Source
var SurveyOptions = make([]survey.AskOpt, 0)

SurveyOptions is the options passed to the survey library

Functions

func Init

func Init() (manifest.Manifest, error)

Init handles the user interaction happening during the init command

func InitNonInteractive added in v0.1.1

func InitNonInteractive(val InitValues) (manifest.Manifest, error)

Types

type InitValues added in v0.1.1

type InitValues = struct {
	Name        string
	Type        string
	Description string
	Version     string
	License     string
}

type LoginPayload

type LoginPayload struct {
	Login    string
	Password string
}

LoginPayload is the data retrieved from the user to log them in.

func Login

func Login() (*LoginPayload, error)

Login handles the user interaction during the login command.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL