os

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2020 License: GPL-3.0 Imports: 5 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 = "os"

	GetwdFuncName     = "getwd"
	ChdirFuncName     = "chdir"
	GetenvFuncName    = "getenv"
	SetenvFuncName    = "setenv"
	WriteFileFuncName = "write_file"
	ReadFileFuncName  = "read_file"
	MkdirFuncName     = "mkdir"
	MkdirAllFuncName  = "mkdir_all"
	RemoveFuncName    = "remove"
	RemoveAllFuncName = "remove_all"
	RenameFuncName    = "rename"
)

Variables

This section is empty.

Functions

func Chdir

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

Chdir changes the current working directory to the named directory.

outline: os
  functions:
    chdir(dir)
      changes the current working directory to the named directory.
      params:
        dir string
          target dir

func Getenv

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

Getenv retrieves the value of the environment variable named by the key.

outline: os
  functions:
    getenv(key) dir
      retrieves the value of the environment variable named by the key.
      params:
        key string
          name of the environment variable

func Getwd

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

Getwd returns a rooted path name corresponding to the current directory.

outline: os
  functions:
    getwd() dir
      returns a rooted path name corresponding to the current directory.

func LoadModule

func LoadModule() (starlark.StringDict, error)

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

outline: os
  os provides a platform-independent interface to operating system functionality.
  path: os

func Mkdir

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

Mkdir creates a new directory with the specified name and permission bits (before umask).

outline: os
  functions:
    mkdir(name, perms=0o777)
      creates a new directory with the specified name and permission bits (before umask).
      params:
        name string
          name of the folder to be created
        perms int
           optional, permission of the folder

func MkdirAll

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

MkdirAll creates a directory named path, along with any necessary parents.

outline: os
  functions:
    mkdir_all(name, perms=0o777)
      creates a new directory with the specified name and permission bits (before umask).
      params:
        name string
          name of the folder to be created
        perms int
           optional, permission of the folder

func ReadFile

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

ReadFile reads the file named by filename and returns the contents.

outline: os
  functions:
    read_file(filename) string
      reads the file named by filename and returns the contents.
      params:
        filename string
          name of the file to be written
        data string
           content to be witten to the file
        perms int
           optional, permission of the file

func Remove

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

Remove removes the named file or (empty) directory.

outline: os
  functions:
    remove(name)
      removes the named file or (empty) directory.
      params:
        name string
          name of the file or directory to be deleted

func RemoveAll

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

RemoveAll removes path and any children it contains.

outline: os
  functions:
    remove_all(path)
      removes path and any children it contains. It removes everything it
      can but returns the first error it encounters.
      params:
        name string
          path to be deleted

func Rename

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

Rename renames (moves) oldpath to newpath. If

outline: os
  functions:
    rename(oldpath, newpath)
      renames (moves) oldpath to newpath. If newpath already exists and is
      not a directory, Rename replaces it. OS-specific restrictions may
      apply when oldpath and newpath are in different directories.
      params:
        oldpath string
          old path
        newpath string
          new path

func Setenv

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

Setenv sets the value of the environment variable named by the key. It returns an error, if any.

outline: os
  functions:
    setenv(key, value) dir
      sets the value of the environment variable named by the key.
      params:
        key string
          name of the environment variable
        value string
          value of the environment variable

func WriteFile

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

WriteFile writes data to a file named by filename. If the file does not exist, WriteFile creates it with permissions perm; otherwise WriteFile truncates it before writing.

outline: os
  functions:
    write_file(filename, data, perms=0o644)
      retrieves the value of the environment variable named by the key.
      params:
        filename string
          name of the file to be written
        data string
           content to be witten to the file
        perms int
           optional, permission of the file

Types

This section is empty.

Jump to

Keyboard shortcuts

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