gkgfiler

package module
v0.0.0-...-8563a92 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2017 License: BSD-3-Clause Imports: 7 Imported by: 0

README

日本語はこちら

gkgfiler

gkgfiler(gokigen-filer) make you happy about file operations.

Sometimes it is troublesome to do something sometimes, such as recursively searching for files, replacing parts of files,adding it to the end of the file, checking if the file contains a string, etc.

So compiled those into a function.

package gkgfiler

    import "github.com/sasasaiki/gkgfiler"

FUNCTIONS

func AppendText(path, appendStr string, perm os.FileMode) error
    AppendText apeend appendStr at the end of the file
    perm is permittion. exsample 0777.
func Contains(filename, findStr string) (bool, error)
    Contains return whether file contains findStr
func Exist(path string) bool
    Exist is check file exist
func GetGoSrcPath() (string, error)
    GetGoSrcPath is get $GOPATH/src
func GetPaths(dir string, includeDir bool, matchingPatterns ...string) (matches []string, e error)
    GetPaths get files (and directory if includeDir=true) that match
    patterns

	matchingPatterns exsample "*.go","*.yaml"
	if you want all , "*"
func GetPathsRecurcive(dir string, includeDir bool, matchingPatterns ...string) (paths []string, e error)
    GetPathsRecurcive recursively find and get files (and directory if
    includeDir=true) that match patterns recurcive.

	matchingPatterns exsample "*.go","*.yaml"
	if you want all , "*"
func IsDir(path string) (bool, error)
    IsDir return whether it is directory or notDirectory
func ReplaceText(filename, origin, replace string, perm os.FileMode) error
    ReplaceText replace originStr to replaceStr
    perm is permittion. exsample 0777.
func WriteText(path, str string, createIfNothing bool, perm os.FileMode) error
    WriteText write text to file
    When createIfNothing is set to true, a case where it does not exist is created and written
    perm is permittion. exsample 0777.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendText

func AppendText(path, appendStr string, perm os.FileMode) error

AppendText apeend appendStr at the end of the file perm is permittion. exsample 0777.

func Contains

func Contains(filename, findStr string) (bool, error)

Contains return whether file contains findStr

func Exist

func Exist(path string) bool

Exist is check file exist

func GetGoSrcPath

func GetGoSrcPath() (string, error)

GetGoSrcPath is get $GOPATH/src

func GetPaths

func GetPaths(dir string, includeDir bool, matchingPatterns ...string) (matches []string, e error)

GetPaths get files (and directory if includeDir=true) that match patterns

matchingPatterns exsample "*.go","*.yaml"
if you want all , "*"

func GetPathsRecurcive

func GetPathsRecurcive(dir string, includeDir bool, matchingPatterns ...string) (paths []string, e error)

GetPathsRecurcive recursively find and get files (and directory if includeDir=true) that match patterns recurcive.

matchingPatterns exsample "*.go","*.yaml"
if you want all , "*"

func IsDir

func IsDir(path string) (bool, error)

IsDir return whether it is directory or notDirectory

func ReplaceText

func ReplaceText(filename, origin, replace string, perm os.FileMode) error

ReplaceText replace originStr to replaceStr perm is permittion. exsample 0777.

func WriteText

func WriteText(path, str string, createIfNothing bool, perm os.FileMode) error

WriteText write text to file perm is permittion. exsample 0777. When createIfNothing is set to true, a case where it does not exist is created and written

Types

This section is empty.

Jump to

Keyboard shortcuts

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