2018-02-17 20:12:41 +02:00
|
|
|
package compiler
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"strings"
|
|
|
|
|
2023-12-29 22:32:03 +02:00
|
|
|
"github.com/go-task/task/v3/taskfile/ast"
|
2018-02-17 20:12:41 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// GetEnviron the all return all environment variables encapsulated on a
|
2023-12-29 22:32:03 +02:00
|
|
|
// ast.Vars
|
|
|
|
func GetEnviron() *ast.Vars {
|
|
|
|
m := &ast.Vars{}
|
2020-03-29 21:54:59 +02:00
|
|
|
for _, e := range os.Environ() {
|
2018-02-17 20:12:41 +02:00
|
|
|
keyVal := strings.SplitN(e, "=", 2)
|
|
|
|
key, val := keyVal[0], keyVal[1]
|
2023-12-29 22:32:03 +02:00
|
|
|
m.Set(key, ast.Var{Value: val})
|
2018-02-17 20:12:41 +02:00
|
|
|
}
|
|
|
|
return m
|
|
|
|
}
|