forked from coop-cloud-mirrors/godotenv
Improve godoc on Read and Exec
This commit is contained in:
parent
b2cd7d822b
commit
1736a884e7
13
godotenv.go
13
godotenv.go
@ -46,6 +46,10 @@ func Load(filenames ...string) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Read all env (with same file loading semantics as Load) but return values as
|
||||||
|
a map rather than automatically writing values into env
|
||||||
|
*/
|
||||||
func Read(filenames ...string) (envMap map[string]string, err error) {
|
func Read(filenames ...string) (envMap map[string]string, err error) {
|
||||||
filenames = filenamesOrDefault(filenames)
|
filenames = filenamesOrDefault(filenames)
|
||||||
envMap = make(map[string]string)
|
envMap = make(map[string]string)
|
||||||
@ -66,6 +70,15 @@ func Read(filenames ...string) (envMap map[string]string, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Loads env vars from the specified filenames (empty map falls back to default)
|
||||||
|
then executes the cmd specified.
|
||||||
|
|
||||||
|
Simply hooks up os.Stdin/err/out to the command and calls Run()
|
||||||
|
|
||||||
|
If you want more fine grained control over your command it's recommended
|
||||||
|
that you use `Load()` or `Read()` and the `os/exec` package yourself.
|
||||||
|
*/
|
||||||
func Exec(filenames []string, cmd string, cmdArgs []string) error {
|
func Exec(filenames []string, cmd string, cmdArgs []string) error {
|
||||||
Load(filenames...)
|
Load(filenames...)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user