console

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 1 Imported by: 8

README

Console

Provide a console for the application bootstrap.

import "gitee.com/go-libs/console"

Provider

Create example provider for command runner like follows.

  • Run(container *console.Container, command *console.Command) - Required
  • After(container *console.Container, command *console.Command, err error)
  • Before(container *console.Container, command *console.Command) error
type Example struct{}

func (o *Example) Run(container *console.Container, command *console.Command) (err error) {
    return
}

Provider

func main(){
    command := console.NewCommand("example")
    command.SetDescription("Example command in main")
    command.SetProvider(&Example{})

    container := console.NewContainer()
    container.add(command)
    container.Run()
}

Run console

You can run follow script on terminal.

cd /data/sketch
go run main.go example

Documentation

Overview

Package console provides a console manager.

Index

Constants

View Source
const (
	KindBool   = src.KindBool
	KindFloat  = src.KindFloat
	KindInt    = src.KindInt
	KindNull   = src.KindNull
	KindString = src.KindString
)

Variables

View Source
var (
	Config       = src.Config
	NewArgument  = src.NewArgument
	NewCommand   = src.NewCommand
	NewContainer = src.NewContainer
	NewOutput    = src.NewOutput
)
View Source
var (
	NewOption      = src.NewOption
	NewBoolOption  = src.NewBoolOption
	NewFloatOption = src.NewFloatOption
	NewIntOption   = src.NewIntOption
	NewNullOption  = src.NewNullOption
)

Functions

This section is empty.

Types

type Argument

type Argument = src.Argument

type Command

type Command = src.Command

type Container

type Container = src.Container

type Kind

type Kind = src.Kind

type Option

type Option = src.Option

type Output

type Output = src.Output

Directories

Path Synopsis
_examples

Jump to

Keyboard shortcuts

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