Documentation ¶
Index ¶
- Constants
- Variables
- func CleanAndExpandPath(path string) string
- func Conf(args []string, tokens Tokens, cmds, all Commands) int
- func Copy(args []string, tokens Tokens, cmds, all Commands) int
- func Create(args []string, tokens Tokens, cmds, all Commands) int
- func Ctl(args []string, tokens Tokens, cmds, all Commands) int
- func EnsureDir(fileName string) bool
- func FileExists(filePath string) bool
- func Help(args []string, tokens Tokens, cmds, all Commands) int
- func List(args []string, tokens Tokens, cmds, all Commands) int
- func MakeConfig(c *Lines) (out *nine.Config)
- func New(args []string, tokens Tokens, cmds, all Commands) int
- func Node(args []string, tokens Tokens, cmds, all Commands) int
- func NormalizeAddress(addr, defaultPort string) string
- func NormalizeAddresses(addrs []string, defaultPort string) []string
- func Parse(args []string) int
- func RemoveDuplicateAddresses(addrs []string) []string
- func Shell(args []string, tokens Tokens, cmds, all Commands) int
- func Start(args []string) int
- func Test(args []string, tokens Tokens, cmds, all Commands) int
- func ValidName(s string) bool
- func Wallet(args []string, tokens Tokens, cmds, all Commands) int
- type Command
- type Commands
- type Line
- func Addr(s string) *Line
- func Addrs(s string) *Line
- func Algo(s string) *Line
- func Dir(s string) *Line
- func Duration(s string) *Line
- func Enable(s string) *Line
- func Enabled(s string) (o *Line)
- func File(s string) *Line
- func Float(s string) *Line
- func Int(s string) *Line
- func Log(s string) *Line
- func Net(s string) (o *Line)
- func Port(s string) *Line
- func Tag(s string) *Line
- func Tags(s string) *Line
- func (l *Line) BOOL(v ...bool) *bool
- func (l *Line) Default(d interface{}) (out *Line)
- func (l *Line) FLOAT(v ...float64) *float64
- func (l *Line) INT(v ...int) *int
- func (l *Line) Label(name string) *Line
- func (l *Line) MAP(v ...nine.Mapstringstring) *nine.Mapstringstring
- func (l *Line) Max(i int) *Line
- func (l *Line) Min(i int) *Line
- func (l *Line) SLICE(v ...[]string) *[]string
- func (l *Line) STRING(v ...string) *string
- func (l *Line) Usage(s string) *Line
- type Lines
- type Stringslice
- type Token
- type Tokens
Constants ¶
const ( APPNAME = "9" APPDESC = "all in one everything for parallelcoin" APPVERSION = "v1.9.9" HELP, RE_HELP = "help", "(h|help)" CONF, RE_CONF = "conf", "(C|conf)" NEW, RE_NEW = "new", "(N|new)" COPY, RE_COPY = "copy", "(cp|copy)" LIST, RE_LIST = "list", "(l|list|listcommands)" CTL, RE_CTL = "ctl", "(c|ctl)" NODE, RE_NODE = "node", "(n|node)" WALLET, RE_WALLET = "wallet", "(w|wallet)" SHELL, RE_SHELL = "shell", "(s|shell)" TEST, RE_TEST = "test", "(t|test)" CREATE, RE_CREATE = "create", "(cr|create)" LOG, RE_LOG = "log", "(L|log)" DATADIR, RE_DATADIR = "datadir", "(([A-Za-z][:])|[\\~/.]+.*)" INTEGER, RE_INTEGER = "integer", "[0-9]+" FLOAT, RE_FLOAT = "float", "([0-9]*[.][0-9]+)" WORD, RE_WORD = "word", "([a-zA-Z0-9._-]+)" )
Variables ¶
var Config = MakeConfig(config)
var ConfigFile string
var DataDir string
var Networks = []string{"mainnet", "testnet", "simnet", "regtestnet"}
Functions ¶
func CleanAndExpandPath ¶
CleanAndExpandPath expands environment variables and leading ~ in the passed path, cleans the result, and returns it.
func EnsureDir ¶
EnsureDir checks a file could be written to a path, creates the directories as needed
func FileExists ¶
FileExists reports whether the named file or directory exists.
func MakeConfig ¶
func NormalizeAddress ¶
NormalizeAddress returns addr with the passed default port appended if there is not already a port specified.
func NormalizeAddresses ¶
NormalizeAddresses returns a new slice with all the passed peer addresses normalized with the given default port, and all duplicates removed.
func RemoveDuplicateAddresses ¶
RemoveDuplicateAddresses returns a new slice with all duplicate entries in addrs removed.
Types ¶
type Command ¶
type Command struct { // How to identify a specific item RE *regexp.Regexp // Short help information to show Usage string // Detailed information to show on specific help page Detail string // Optional keywords that may appear with the command Optional opts // Precedent indicates other commands that will preferentially match Precedent precedent // Handler Handler func(args []string, tokens Tokens, cmds, all Commands) int // contains filtered or unexported fields }
Command is a set-based syntax for command line invocation. A set has a more limited range of possibilities when an item type cannot appear more than once, but for any given task, there usually is only one thing for each type required.
If more detailed stuff is needed, we provide access through a configuration interactive CLI.
nil values in opt/prec indicate wildcards, empty means no other acceptable.
type Line ¶
type Line struct { // Name is here so we can detach from the map but know the name to refer to // it when it is stored in a map Name string // Initial is the default for this value Initial interface{} // Validate returns true if the string is properly formed for the type Validate func(*Line, interface{}) bool // The help string that will be shown by the interactive config system and // cli help Comment string // Value is where this value is actually stored Value interface{} }
Line is a configuration line, made into map becomes a configuration thingy that has set-like properties.
func (*Line) MAP ¶
func (l *Line) MAP(v ...nine.Mapstringstring) *nine.Mapstringstring
type Stringslice ¶
type Stringslice []string
func (Stringslice) String ¶
func (s Stringslice) String() (out string)