appConfig

package module
v0.0.0-...-721c6c5 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2014 License: MIT Imports: 4 Imported by: 5

README

appConfig

Build Status Coverage Status

=========

homedir read write to app config file for golang ( Go )

Example

source

package main

import (
	"github.com/kyokomi/appConfig"
	"bytes"
	"log"
	"fmt"
)

func main() {

	accessToken := "aaaaaaaaaaaaaaaaaaaaa"

	c := appConfig.NewAppConfig("goSampleApp")
	err := c.WriteAppConfig(bytes.NewBufferString(accessToken).Bytes())
	if err != nil {
		log.Fatal(err)
	}

	data, err := c.ReadAppConfig()
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(string(data))
}

Install

$ go get github.com/kyokomi/appConfig

License

MIT

Author

kyokomi

Documentation

Overview

Package appConfig ~/.{appName}/configの書き込み,作成,読み込みを行うパッケージ

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	ConfigFileName string
	ConfigDirPath  string
	AppName        string
}

func NewAppConfig

func NewAppConfig(appName, configFileName string) *AppConfig

func NewDefaultAppConfig

func NewDefaultAppConfig(appName string) *AppConfig

NewAppConfig create AppConfig.

func (AppConfig) AppConfigFilePath

func (a AppConfig) AppConfigFilePath() string

func (AppConfig) ReadAppConfig

func (a AppConfig) ReadAppConfig() ([]byte, error)

configファイルを読み込む[]byte.

func (AppConfig) RemoveAppConfig

func (a AppConfig) RemoveAppConfig() error

func (AppConfig) WriteAppConfig

func (a AppConfig) WriteAppConfig(data []byte) error

configファイルを作成する中身は空.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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