cmd

package
v0.0.0-...-d7093dc Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Version version
	Version = "1.0.0"
	// HomePage homepage
	HomePage = "https://github.com/qeesung/asciiplayer"
	// Author author
	Author = "qeesung"
	// ShortTitle shortTitle
	ShortTitle = "asciiplayer/" + Version + " _(>.ო.<)_ _(>.ო.<)_ _(>.ო.<)_"

	// Title title
	Title = `` /* 326-byte string literal not displayed */

	// SummaryTitle summary title
	SummaryTitle = Title + "\n>>>Version  : " + Version + "\n>>>Author   : " + Author + "\n>>>HomePage : " + HomePage
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cli

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

Cli is wrapper for root command and add common options

func NewCli

func NewCli() *Cli

NewCli create a new cli object

func (*Cli) AddCommand

func (cli *Cli) AddCommand(parent, child Command)

AddCommand add a child command to parent command

func (*Cli) InitLog

func (cli *Cli) InitLog()

InitLog init the log , and config the log

func (*Cli) Run

func (cli *Cli) Run() error

Run start to run the cli command

func (*Cli) SetFlags

func (cli *Cli) SetFlags() *Cli

SetFlags for cli define the global flags

type Command

type Command interface {
	Init()
	Cmd() *cobra.Command
}

Command define the command basic operations

type CommandBuilder

type CommandBuilder struct {
}

CommandBuilder responsible for building root command and register all sub commands to the root command

func (*CommandBuilder) Build

func (builder *CommandBuilder) Build() *Cli

Build create root command and register all sub command and return the cli object that contain the root command

type EncodeCommand

type EncodeCommand struct {
	convert.Options
	Delay           float64
	FontSize        int
	BackGroundColor string
	ForeGroundColor string
	OutputFilename  string
	// contains filtered or unexported fields
}

EncodeCommand is responsible for encoding

func (*EncodeCommand) Cmd

func (b *EncodeCommand) Cmd() *cobra.Command

Cmd return the cobra Command object

func (*EncodeCommand) Init

func (encodeCommand *EncodeCommand) Init()

Init for encode command create a command and add flags

type ExitError

type ExitError struct {
	Code   int
	ErrMsg string
}

ExitError implement the Error interface and add some custom error code nad error message

func (ExitError) Error

func (e ExitError) Error() string

Error function implement the Error interface

type PlayCommand

type PlayCommand struct {
	convert.Options
	Delay float64
	// contains filtered or unexported fields
}

PlayCommand responsible for playing the ASCII image in the terminal

func (*PlayCommand) Cmd

func (b *PlayCommand) Cmd() *cobra.Command

Cmd return the cobra Command object

func (*PlayCommand) Init

func (playCommand *PlayCommand) Init()

Init for play command create a play command and add flags

type ServerCommand

type ServerCommand struct {
	convert.Options
	Delay float64
	Host  string
	Port  string
	// contains filtered or unexported fields
}

ServerCommand define the server command that responsible for serving a http server for ASCII image.

func (*ServerCommand) Cmd

func (b *ServerCommand) Cmd() *cobra.Command

Cmd return the cobra Command object

func (*ServerCommand) Init

func (serverCommand *ServerCommand) Init()

Init for ServerCommand create the server command

type VersionCommand

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

VersionCommand is responsible show the version

func (*VersionCommand) Cmd

func (b *VersionCommand) Cmd() *cobra.Command

Cmd return the cobra Command object

func (*VersionCommand) Init

func (versionCommand *VersionCommand) Init()

Init for VersionCommand create a version command

Jump to

Keyboard shortcuts

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