summaryrefslogtreecommitdiff
path: root/cmds/export.go
blob: 1c2632da216fcb7904141a0b008d152c2a8e770c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package cmds

import (
	"errors"
	"os"
	"strings"
)

func export(args []string) error {
	if len(args) == 1 || len(args) >= 3 {
		return errors.New("usage: export {name=value}")
	}
	tmp := strings.Split(args[1], "=")
	if len(tmp) != 2 {
		return errors.New("usage: export {name=value}")
	}
	return os.Setenv(tmp[0], tmp[1])
}