filepath

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName defines the expected name for this Module when used
	// in starlark's load() function, eg: load('io/ioutil', 'json')
	ModuleName = "path/filepath"
)

Variables

This section is empty.

Functions

func Abs

func Abs(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

Abs returns an absolute representation of path. If the path is not absolute it will be joined with the current working directory to turn it into an/ absolute path.

outline: filepath
  functions:
    abs(path) string
      returns an absolute representation of path. If the path is not
      absolute it will be joined with the current working directory to turn
      it into an absolute path.
      params:
        path string
          relative or absolute path

func Base

func Base(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

Base returns the last element of path. Trailing path separators are removed before extracting the last element. If the path is empty, Base returns ".". If the path consists entirely of separators, Base returns a single separator.

outline: filepath
  functions:
    base(path) string
      returns the last element of path. Trailing path separators are
      removed before extracting the last element. If the path is empty,
      `base` returns ".". If the path consists entirely of separators,
      `base` returns a single separator.
      params:
        path string
          input path

func Clean

func Clean(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

Clean returns the shortest path name equivalent to path by purely lexical processing.

outline: filepath
  functions:
    clean(path) string
      returns the shortest path name equivalent to path by purely lexical
      processing.
      params:
        path string
          input path

func Dir

func Dir(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

Dir returns all but the last element of path, typically the path's directory.

outline: filepath
  functions:
    dir(path) string
      returns all but the last element of path, typically the path's
      directory. After dropping the final element, `dir` calls `clean` on the
      path and trailing slashes are removed. If the path is empty, `dir`
      returns ".". If the path consists entirely of separators, `dir`
      returns a single separator. The returned path does not end in a
      separator unless it is the root directory.
      params:
        path string
          input path

func Ext

func Ext(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

Ext returns the file name extension used by path. The extension is the suffix beginning at the final dot in the final element of path; it is empty if there is no dot.

outline: filepath
  functions:
    ext(path) string
      returns the file name extension used by path. The extension is the
      suffix beginning at the final dot in the final element of path; it
      is empty if there is no dot.
      params:
        path string
          input path

func Glob

func Glob(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

Glob returns the names of all files matching pattern or nil if there is no matching file.

outline: filepath
  functions:
    glob(pattern) list
      returns the names of all files matching pattern or None if there is
      no matching file.
      params:
        pattern string
          pattern ([syntax](https://golang.org/pkg/path/filepath/#Match))

func IsAbs

func IsAbs(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

IsAbs reports whether the path is absolute.

outline: filepath
  functions:
    is_abs(path) bool
      reports whether the path is absolute.
      params:
        path string
          input path

func Join

func Join(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

Join joins any number of path elements into a single path, adding a Separator if necessary.

outline: filepath
  functions:
    join(elements) string
      joins any number of path elements into a single path, adding a
      `filepath.separator` if necessary. Join calls Clean on the result;
      in particular, all empty strings are ignored. On Windows, the result
      is a UNC path if and only if the first path element is a UNC path.
      params:
        elements lists
          list of path elements to be joined

func LoadModule

func LoadModule() (starlark.StringDict, error)

LoadModule loads the os module. It is concurrency-safe and idempotent.

outline: filepath
  filepath implements utility routines for manipulating filename paths in a
  way compatible with the target operating system-defined file path
  path: path/filepath

func Rel

func Rel(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

Rel returns a relative path that is lexically equivalent to targpath when joined to basepath with an intervening separator.

outline: filepath
  functions:
    rel(basepath, targpath) string
      returns a relative path that is lexically equivalent to targpath when
      joined to basepath with an intervening separator. That is, `filepath.join(basepath, filepath.rel(basepath, targpath))`
      is equivalent to targpath itself. On success, the returned path will
      always be relative to basepath, even if basepath and targpath share
      no elements. An error is returned if targpath can't be made relative
      to basepath or if knowing the current working directory would be
      necessary to compute it. Rel calls Clean on the result.
      params:
        basepath string
          relative or absolute path
        targpath string
          relative or absolute path

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL