Skip to content

Commit

Permalink
feat: add IsValidDir validation
Browse files Browse the repository at this point in the history
  • Loading branch information
metacosm committed Oct 7, 2019
1 parent 3d5bddf commit 2d277c7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ func CheckFileExist(fileName string) bool {
return true
}

func IsValidDir(fileName string) bool {
info, err := os.Stat(fileName)
if os.IsNotExist(err) || !info.IsDir() {
return false
}
return true
}

func IsValid(value string, validValues []string) bool {
for _, v := range validValues {
if value == v {
Expand Down

0 comments on commit 2d277c7

Please sign in to comment.