Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Commit

Permalink
Expand Home with mitchellh/go-homedir if type is FilePath
Browse files Browse the repository at this point in the history
  • Loading branch information
Balazs Nadasdi committed May 16, 2019
1 parent 9bd7f7f commit 927ce10
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions argument.go
Expand Up @@ -5,6 +5,8 @@ import (
"os"
"strconv"
"strings"

"github.com/mitchellh/go-homedir"
)

type argumentTypeFunction func(string) (interface{}, error)
Expand Down Expand Up @@ -57,6 +59,7 @@ func init() {
})

RegisterArgumentType("FilePath", func(value string) (interface{}, error) {
value, _ = homedir.Expand(value)
_, err := os.Stat(value)

if os.IsNotExist(err) {
Expand Down

0 comments on commit 927ce10

Please sign in to comment.