Skip to content

walle/fval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Godoc license Go Report Card

fval

Simple package for validating file and directory existence, eg. input to CLI applications. Originally built for go-arg - Pull request. The pull request was not accepted as go-arg is to be kept minimal, so this is extracted to a separate package. The usage is of course not limited to CLI application input, it is general purpose, but was built with CLI input in mind.

Installation

$ go get github.com/walle/fval

Usage

// CLI application with usage: example INPUTFILE OUTPUTDIR
if !fval.FileExists(os.Args[1]) {
        fmt.Fprintf(os.Stderr, "Usage error: %s is not a valid file", os.Args[1])
        os.Exit(1)
}

fval.DirExistsOrCreate(os.Args[2], 0766)

Testing

Use the go test tool.

$ go test -cover

Contributing

All contributions are welcome! See CONTRIBUTING for more info.

License

The code is under the MIT license. See LICENSE for more information.

About

Simple go library for validating file and directory existence

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages