cli

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package cli contains all the command implements

Package cli provides all the commands

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRootCommand

func NewRootCommand(execer exec.Execer, out io.Writer) (cmd *cobra.Command)

NewRootCommand returns the instance of cobra.Command

Types

type GolangScript added in v0.0.2

type GolangScript struct {
	Script
}

GolangScript represents the Golang script

func (*GolangScript) GetTitle added in v0.0.2

func (s *GolangScript) GetTitle() string

GetTitle returns the title of this script

func (*GolangScript) Run added in v0.0.2

func (s *GolangScript) Run(ctx context.Context) (err error)

Run executes the script

type GroovyScript added in v0.0.4

type GroovyScript struct {
	Script
}

GroovyScript represents the Python script

func (*GroovyScript) GetTitle added in v0.0.4

func (s *GroovyScript) GetTitle() string

GetTitle returns the title of this script

func (*GroovyScript) Run added in v0.0.4

func (s *GroovyScript) Run(ctx context.Context) (err error)

Run executes the script

type PythonScript added in v0.0.2

type PythonScript struct {
	Script
}

PythonScript represents the Python script

func (*PythonScript) GetTitle added in v0.0.2

func (s *PythonScript) GetTitle() string

GetTitle returns the title of this script

func (*PythonScript) Run added in v0.0.2

func (s *PythonScript) Run(ctx context.Context) (err error)

Run executes the script

type QuitRunner added in v0.0.2

type QuitRunner struct{}

QuitRunner represents a runner for quit

func (*QuitRunner) GetTitle added in v0.0.2

func (r *QuitRunner) GetTitle() string

GetTitle returns the title

func (*QuitRunner) Run added in v0.0.2

func (r *QuitRunner) Run(context.Context) error

Run does nothing

type Script added in v0.0.2

type Script struct {
	Kind        string
	Title       string
	Content     string
	Dir         string
	KeepScripts bool
	Execer      exec.Execer
}

Script represents a script object

type ScriptRunner added in v0.0.2

type ScriptRunner interface {
	Run(context.Context) error
	GetTitle() string
}

ScriptRunner is the interface of a common runner

type ScriptRunners added in v0.0.2

type ScriptRunners []ScriptRunner

ScriptRunners is an alias of the ScriptRunner slice

func NewScriptRunners added in v0.0.2

func NewScriptRunners() ScriptRunners

NewScriptRunners returns the instance of ScriptRunners

func (ScriptRunners) GetRunner added in v0.0.2

func (s ScriptRunners) GetRunner(title string) ScriptRunner

GetRunner returns the runner by title

func (ScriptRunners) GetTitles added in v0.0.2

func (s ScriptRunners) GetTitles() (titles []string)

GetTitles returns all the titles

func (ScriptRunners) Size added in v0.0.2

func (s ScriptRunners) Size() int

Size returns the size of the script runners

type ShellScript added in v0.0.2

type ShellScript struct {
	Script
	ShellType string
}

ShellScript represents the shell script

func (*ShellScript) GetTitle added in v0.0.2

func (s *ShellScript) GetTitle() string

GetTitle returns the title of this script

func (*ShellScript) Run added in v0.0.2

func (s *ShellScript) Run(ctx context.Context) (err error)

Run executes the script

Jump to

Keyboard shortcuts

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