getoptions

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2016 License: ISC Imports: 3 Imported by: 0

Documentation

Overview

command-line options processing

Parses options of the forms:

-option               - increment otion count
-option=value         - set value
--option              - increment option count
--option=value        - set value
--                    - stop option parsing

Note:

Does not support combined single letter options e.g. -vvv is the same as --vvv
and is the separate option "vvv".
Repeated options cause the value string to be appended to the options map item.
Options with no value append the empty string, e.g. "-v -v -v" would make len(options["v"]) == 3.

Alias table:

This allows the option to be aliased e.g. -v -> --verbose

Returns:

program_name          - string
options               - map["option"]=[]string{"value1","value2"}
arguments             - []string  (all options not starting with "-" and everything after --)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliasMap

type AliasMap map[string]string

aliases

type OptionsMap

type OptionsMap map[string][]string

returned options

func Get

func Get(inputs []string, aliases AliasMap) (options OptionsMap, arguments []string)

get options from array

func GetOS

func GetOS(aliases AliasMap) (program string, options OptionsMap, arguments []string)

from OS command-line

Jump to

Keyboard shortcuts

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