File: mod.go

package info (click to toggle)
direnv 2.37.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 872 kB
  • sloc: sh: 1,499; csh: 83; makefile: 7
file content (30 lines) | stat: -rw-r--r-- 642 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package cmd

import (
	"fmt"
	"os"
)

var (
	bashPath string
	stdlib   string
	version  string
)

// Main is the main entrypoint to direnv
func Main(env Env, args []string, modBashPath string, modStdlib string, modVersion string) error {
	// We drop $PWD from caller since it can include symlinks, which will
	// break relative path access when finding .envrc or .env in a parent.
	_ = os.Unsetenv("PWD")

	setupLogging(env)
	bashPath = modBashPath
	stdlib = modStdlib
	version = modVersion

	err := CommandsDispatch(env, args)
	if err != nil {
		fmt.Fprintf(os.Stderr, "%sdirenv: error %v%s\n", errorColor, err, clearColor)
	}
	return err
}