ini

package
v4.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package ini provides trivial parsing of .INI format files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Config is a parsed INI format file.

func Parse

func Parse(stream io.Reader) Config

Parse reads the given io.Reader and returns a parsed Config object.

func (*Config) AddComment

func (c *Config) AddComment(sect, comment string)

AddComments appends the comment to the list of comments for the section.

func (*Config) Comments

func (c *Config) Comments(section string) []string

Comments returns the list of comments in a given section. For the empty string, returns the file comments.

func (*Config) Delete

func (c *Config) Delete(section, key string)

Delete removes the option from the specified section.

func (*Config) Get

func (c *Config) Get(section, key string) string

Get gets the value from the specified section and key name, or the empty string if either the section or the key is missing.

func (*Config) OptionMap

func (c *Config) OptionMap(section string) map[string]string

OptionMap returns the map option => value for a given section.

func (*Config) Options

func (c *Config) Options(section string) []string

Options returns the list of options in a given section.

func (*Config) Sections

func (c *Config) Sections() []string

Sections returns the list of sections in the file.

func (*Config) Set

func (c *Config) Set(sectionName, key, value string)

Set sets a value for an option in a section. If the option exists, it's value will be overwritten. If the option does not exist, it will be added. If the section does not exist, it will be added and the option added to it.

func (*Config) Write

func (c *Config) Write(out io.Writer) error

Write writes the sections and options to the io.Writer in INI format.

Jump to

Keyboard shortcuts

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