types

package
v0.0.0-...-0f41625 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCLI

func NewCLI() cli.CLI

NewCLI creates a new empty CLI object

func NewEnv

func NewEnv() cli.Env

func NewPrompt

func NewPrompt() cli.Prompt

NewPrompt returns a new Prompt object

Types

type CLI

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

CLI object hold the core IO and execution functions

func (*CLI) ChildCli

func (Cli *CLI) ChildCli(newPrompt string, currentEnv cli.Env) cli.CLI

func (*CLI) CommandList

func (Cli *CLI) CommandList() []cli.Command

func (*CLI) ExecutionEngine

func (Cli *CLI) ExecutionEngine(input cli.ArgList, env cli.Env) error

func (*CLI) GenerateNewEnv

func (Cli *CLI) GenerateNewEnv(a ...string) cli.Env

GenerateNewEnv reads a {list} of file addresses to import commands

func (*CLI) HelloWorld

func (Cli *CLI) HelloWorld()

HelloWorld prints HelloWorld to the shell

func (*CLI) Init

func (Cli *CLI) Init(cli.Env) error

func (*CLI) Loop

func (Cli *CLI) Loop() error

func (*CLI) ReadInput

func (Cli *CLI) ReadInput(cli.Env) cli.ArgList

type Command

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

Command script is the one

func (*Command) Aliases

func (C *Command) Aliases() []string

Aliases returns all possible alternative names

func (*Command) Description

func (C *Command) Description() string

Description returns a brief summary of the command's effect

func (*Command) Execute

func (C *Command) Execute([]string) error

func (*Command) Flags

func (C *Command) Flags() []string

Flags returns possible flags to adjust command execution

func (*Command) Help

func (C *Command) Help() string

func (*Command) Match

func (C *Command) Match(input string) bool

Match checks if the input string matches the commands aliases

func (*Command) Name

func (C *Command) Name() string

Name returns the given name of the command

func (*Command) ReadFlags

func (C *Command) ReadFlags(inputargs []string) (res map[string][]string, err error)

ReadFlags returns the input per tag

type Env

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

func (*Env) CommandsList

func (E *Env) CommandsList() []cli.Command

CommandsList returns a list of all possible commands

func (*Env) Error

func (E *Env) Error(a ...string) error

func (*Env) FetchJSON

func (E *Env) FetchJSON(jsonFiles ...string) error

Loads scripts from a JSON Document

func (*Env) History

func (E *Env) History() []string

History list all past input args

func (*Env) Log

func (E *Env) Log(output string) error

Log writes a copy of an input string to file

func (*Env) Prompt

func (E *Env) Prompt() cli.Prompt

func (*Env) ScriptsList

func (E *Env) ScriptsList() []cli.Command

func (*Env) WrapError

func (E *Env) WrapError(s string, err error) error

WrapError returns a new version of the error nessage

type JSONScriptCommand

type JSONScriptCommand struct {
	Name          string   `json:"Name"`
	Aliases       []string `json:"Aliases"`
	Regex         string   `json:"Regex"`
	Description   string   `json:"Description"`
	Flags         []string `json:"Flags"`
	Help          string   `json:"Help"`
	ScriptAddress string   `json:"ScriptAddresss"`
}

JSONScriptCommand holds unmarshalled data from script Command.json list

type Prompt

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

Prompt struct holds the data for the commandline prompt

func (*Prompt) Pop

func (P *Prompt) Pop() string

Pop returns the old head

func (*Prompt) Prompt

func (P *Prompt) Prompt() string

Prompt func returns the stringified version of the prompt

func (*Prompt) Push

func (P *Prompt) Push(newhead string)

Push appends a new head to the prompt

func (*Prompt) Raw

func (P *Prompt) Raw() []string

Raw returns image of the array

type ScriptsList

type ScriptsList []JSONScriptCommand

ScriptsList is the Javascript Object stored in Command.json files

Jump to

Keyboard shortcuts

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