argparse

package module
v0.0.0-...-b0137d1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2015 License: MIT Imports: 4 Imported by: 1

README

argparse

Argument Parsing MUST be simple!

Travis Godoc

credits:

Thanks to mgutz for porting the original minimist to golang. (Repo)

license:

The MIT License (MIT)

Copyright © 2015 GochoMugo mugo@forfuture.co.ke

Documentation

Overview

Package argparse keeps parsing command-line arguments simple!

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	minimist.ArgMap
}

Args is a struct passed to all command functions. It has the ArgMap from minimist embedded.

type Program

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

Program is the terminal interface object

Example
prog := New()
prog.Description("example", "description")
prog.Version("0.0.0")
prog.Epilog("epilog")
prog.Command("s", "start", "starts application", func(a Args) {})

prog.ShowHelp()
Output:

example: description

Available Commands:
    H, help       show help information
    V, version    show version information
    s, start      starts application

epilog

func New

func New() *Program

New returns a new Program parser

func (*Program) Command

func (prog *Program) Command(short, long, description string, handler func(Args)) *Program

Command adds a new command

func (*Program) Description

func (prog *Program) Description(name, description string) *Program

Description adds a name and description of the program

func (*Program) Epilog

func (prog *Program) Epilog(epilog string) *Program

Epilog adds an epilog

func (*Program) Parse

func (prog *Program) Parse() *Program

Parse does the argument parsing

func (*Program) ShowHelp

func (prog *Program) ShowHelp() *Program

ShowHelp shows help information to users

func (*Program) ShowVersion

func (prog *Program) ShowVersion() *Program

ShowVersion shows version information to users

func (*Program) Version

func (prog *Program) Version(version string) *Program

Version adds version information

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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