// NewWithPath returns a new instance of Loader to read from the given
// configuration file.
170273
func NewWithPath(path string) *DefaultLoader {
	loaders := []Loader{}

	// Read default values defined via tag fields "default"
	loaders = append(loaders, &TagLoader{})

	// Choose what while is passed
	if strings.HasSuffix(path, "toml") {
		loaders = append(loaders, &TOMLLoader{Path: path})
	}

	if strings.HasSuffix(path, "json") {
		loaders = append(loaders, &JSONLoader{Path: path})
	}

	if strings.HasSuffix(path, "yml") || strings.HasSuffix(path, "yaml") {
		loaders = append(loaders, &YAMLLoader{Path: path})
	}

	e := &EnvironmentLoader{}
	f := &FlagLoader{}

	loaders = append(loaders, e, f)
	loader := MultiLoader(loaders...)

	d := &DefaultLoader{}
	d.Loader = loader
	d.Validator = MultiValidator(&RequiredValidator{})
	return d
}
136863
func (o *ElapseURL) WithBasePath(bp string) *ElapseURL {
	o.SetBasePath(bp)
	return o
}
939848
func NewPath(pathStr string) (Path, error) {
	components, err := split(pathStr)
	if err != nil {
		return Path{}, err
	}
	len := len(components)

	if (len >= 1 && components[0] != topName) ||
		(len >= 2 && components[1] != publicName && components[1] != privateName) {
		return Path{}, InvalidPathErr{pathStr}
	}

	if len == 0 {
		p := Path{
			PathType: RootPathType,
		}
		return p, nil
	}

	if len == 1 {
		p := Path{
			PathType: KeybasePathType,
		}
		return p, nil
	}

	if len == 2 {
		p := Path{
			PathType: KeybaseChildPathType,
			TLFType:  listTypeToTLFType(components[1]),
		}
		return p, nil
	}

	p := Path{
		PathType:      TLFPathType,
		TLFType:       listTypeToTLFType(components[1]),
		TLFName:       components[2],
		TLFComponents: components[3:],
	}
	return p, nil
}
496677
func WithConfigPath(s string) source.Option {
	return func(o *source.Options) {
		if o.Context == nil {
			o.Context = context.Background()
		}
		o.Context = context.WithValue(o.Context, configPathKey{}, s)
	}
}
966737
func (o *CreateUserURL) WithBasePath(bp string) *CreateUserURL {
	o.SetBasePath(bp)
	return o
}
493522
func NewFilePathName(packagePath, packageName string) *File {
	return &File{
		Group: &Group{
			multi: true,
		},
		name:    packageName,
		path:    packagePath,
		imports: map[string]importdef{},
		hints:   map[string]importdef{},
	}
}
727948
func NewFieldPath(name string, moreNames ...string) *FieldPath {
	r := &FieldPath{name: name, parent: nil}
	for _, anotherName := range moreNames {
		r = &FieldPath{name: anotherName, parent: r}
	}
	return r
}
1113780
func (o *GetFqdnCacheIDURL) WithBasePath(bp string) *GetFqdnCacheIDURL {
	o.SetBasePath(bp)
	return o
}
87435
func NewWithFile(path string) (*Database, error) {
	db := &Database{make(map[string]string), make(map[string]string), path}
	db.customPath = path

	blob, err := Asset("4byte.json")
	if err != nil {
		return nil, err
	}
	if err := json.Unmarshal(blob, &db.embedded); err != nil {
		return nil, err
	}
	// Custom file may not exist. Will be created during save, if needed.
	if _, err := os.Stat(path); err == nil {
		if blob, err = ioutil.ReadFile(path); err != nil {
			return nil, err
		}
		if err := json.Unmarshal(blob, &db.custom); err != nil {
			return nil, err
		}
	}
	return db, nil
}
923814
func NewFromPath(path string) Boxfile {
  raw, _ := ioutil.ReadFile(path)
  return New(raw)
}
672155
func (o *GetPolicyURL) WithBasePath(bp string) *GetPolicyURL {
	o.SetBasePath(bp)
	return o
}
832245
func (s *Set) AddPath(path string) {
	if loader, ok := s.loader.(hasAddPath); ok {
		loader.AddPath(path)
	} else {
		panic(fmt.Sprintf("AddPath() not supported on custom loader of type %T", s.loader))
	}
}
876900
func NewWithSuffix(filename, suffix string) (*File, error) {
	oid := filepath.Base(filename)
	dir := filepath.Dir(filename)
	if err := os.MkdirAll(dir, 0755); err != nil {
		return nil, err
	}

	tempFilename := filename + suffix
	tempFile, err := os.OpenFile(tempFilename, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0644)
	if err != nil {
		return nil, err
	}

	file, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0644)
	if err != nil {
		cleanupFile(tempFile)
		return nil, err
	}

	caw := &File{
		Oid:          oid,
		filename:     filename,
		tempFilename: tempFilename,
		file:         file,
		tempFile:     tempFile,
		hasher:       sha256.New(),
	}

	return caw, nil
}
1172330
func ApplicationWithPath(
	funcs map[string]func([]string),
	scripts []string,
	loader func(string) ([]byte, error),
	copyEnv bool,
	bashPath string) {

	bash, err := NewContext(bashPath, os.Getenv("DEBUG") != "")
	if err != nil {
		log.Fatal(err)
	}
	for name, fn := range funcs {
		bash.ExportFunc(name, fn)
	}
	if bash.HandleFuncs(os.Args) {
		os.Exit(0)
	}

	for _, script := range scripts {
		bash.Source(script, loader)
	}
	if copyEnv {
		bash.CopyEnv()
	}
	status, err := bash.Run("main", os.Args[1:])
	if err != nil {
		log.Fatal(err)
	}
	os.Exit(status)
}
1370353
func (o *GetPrefilterURL) WithBasePath(bp string) *GetPrefilterURL {
	o.SetBasePath(bp)
	return o
}
71514
func NewWithConfig(conf *readline.Config) *Shell {
	rl, err := readline.NewEx(conf)
	if err != nil {
		log.Println("Shell or operating system not supported.")
		log.Fatal(err)
	}

	return NewWithReadline(rl)
}
336791
func (o *GetServiceURL) WithBasePath(bp string) *GetServiceURL {
	o.SetBasePath(bp)
	return o
}