simplecli

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: BSD-3-Clause Imports: 12 Imported by: 5 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package simplecli is simple CLI framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

type CLI struct {
	Application application

	CommandLine *pflag.FlagSet

	ConfigSearchPath []string
	ConfigFile       string
	Config           *viper.Viper

	Log logif.LeveledLogger

	DebugMode   bool
	VerboseMode bool
	ProfileMode string

	InitializeError error
	// contains filtered or unexported fields
}

CLI - CLI main structure

func NewCLI

func NewCLI() (cli *CLI)

NewCLI - New CLI instance.

func (*CLI) BindSameName

func (c *CLI) BindSameName(names ...string) (err error)

BindSameName - Bind viper & pflag parameter.

func (*CLI) Exit

func (c *CLI) Exit(code int)

Exit - Exit CLI application.

func (*CLI) Exit1IfError

func (c *CLI) Exit1IfError(err error)

Exit1IfError - Exit CLI application if error.

func (*CLI) Initialize

func (c *CLI) Initialize() (err error)

Initialize - initialize CLI struct.

func (*CLI) NewCLISetting

func (c *CLI) NewCLISetting() CLISetting

NewCLISetting - New CLISetting instance.

func (*CLI) Setup

func (c *CLI) Setup(setups ...func()) (err error)

Setup - Parse command line & read configuration file.

func (*CLI) StartProfile

func (c *CLI) StartProfile()

StartProfile - Start profiling

func (*CLI) StopProfile

func (c *CLI) StopProfile()

StopProfile - Stop profiling

type CLISetting

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

CLISetting - CLI Setting Structure

func (*CLISetting) ConfigFile

func (c *CLISetting) ConfigFile(path string) func()

ConfigFile - Set ConfigFIle

func (*CLISetting) ConfigSearchPath

func (c *CLISetting) ConfigSearchPath(paths ...string) func()

ConfigSearchPath - Set ConfigSearchPath

Jump to

Keyboard shortcuts

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