Documentation ¶
Index ¶
- Constants
- Variables
- func Dirs(path string) (root string, base string, err error)
- func Entrypoint(path string) (string, error)
- func Filename(path string) (string, error)
- func FindBase(path string, root string) (string, error)
- func FindParentFile(file, start, stop string) (string, error)
- func FindRoot(path string) (dir string, err error)
- func FsDir(path string) (string, error)
- func Resolve(path string, allowMissingBase bool) (jpath []string, base, root string, err error)
- type ErrorFileNotFound
- type ErrorNoBase
Constants ¶
const DefaultEntrypoint = "main.jsonnet"
Variables ¶
var ErrorNoRoot = errors.New(`unable to identify the project root.
Tried to find 'tkrc.yaml' or 'jsonnetfile.json' in the parent directories.
Please refer to https://tanka.dev/directory-structure for more information`)
ErrorNoRoot means no rootDir was found in the parent directories
Functions ¶
func Entrypoint ¶ added in v0.13.0
Entrypoint returns the absolute path of the environments entrypoint file (the one passed to jsonnet.EvaluateFile)
func Filename ¶ added in v0.14.0
Filename returns the name of the entrypoint file. It DOES NOT return an absolute path, only a plain name like "main.jsonnet" To obtain an absolute path, use Entrypoint() instead.
func FindBase ¶ added in v0.14.0
FindBase returns the absolute path of the environments base directory, the one which directly holds the entrypoint file.
func FindParentFile ¶
FindParentFile traverses the parent directory tree for the given `file`, starting from `start` and ending in `stop`. If the file is not found an error is returned.
func FindRoot ¶ added in v0.13.0
FindRoot returns the absolute path of the project root, being the directory that directly holds `tkrc.yaml` if it exists, otherwise the directory that directly holds `jsonnetfile.json`
func FsDir ¶ added in v0.14.0
FsDir returns the most inner directory of path, as reported by the local filesystem
func Resolve ¶
Resolve the given path and resolves the jPath around it. This means it: - figures out the project root (the one with .jsonnetfile, vendor/ and lib/) - figures out the environments base directory (usually the main.jsonnet)
It then constructs a jPath with the base directory, vendor/ and lib/. This results in predictable imports, as it doesn't matter whether the user called called the command further down tree or not. A little bit like git.
Types ¶
type ErrorFileNotFound ¶
type ErrorFileNotFound struct {
// contains filtered or unexported fields
}
ErrorFileNotFound means that the searched file was not found
func (ErrorFileNotFound) Error ¶
func (e ErrorFileNotFound) Error() string
type ErrorNoBase ¶
type ErrorNoBase struct {
// contains filtered or unexported fields
}
ErrorNoBase means no baseDir was found in the parent directories
func (ErrorNoBase) Error ¶ added in v0.14.0
func (e ErrorNoBase) Error() string