file

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package file provides the standard file library used to perform common file operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Include

func Include() script.Option

Include the file library in a script environment.

func Library

func Library() script.Library

Library prepares a new file library for use within a script environment.

Types

type File

type File struct {
	afero.Fs

	Path string
}

File descriptor that can be used with the file library and implements starlark.Value.

func ParseParam added in v0.4.0

func ParseParam(parser script.ArgParser, index int) (*File, error)

ParseParam from starlark input

func (*File) Freeze added in v0.4.0

func (f *File) Freeze()

Freeze is a no-op since the underlying file is safe for concurrent use.

func (*File) Hash added in v0.4.0

func (f *File) Hash() (uint32, error)

Hash will error since the file type is not intended to be hashable.

func (*File) Name

func (f *File) Name() string

Name returns the path used to create the file descriptor.

func (*File) String added in v0.4.0

func (f *File) String() string

String returns the name of the file.

func (*File) Truth added in v0.4.0

func (f *File) Truth() starlark.Bool

Truth value of a file is True if the file is non-nil

func (*File) Type added in v0.4.0

func (f *File) Type() string

Type returns 'file' to indicate the type of the file within starlark.

Jump to

Keyboard shortcuts

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