os

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package os exposes functionality from Go's os package as an Elvish module.

Index

Constants

View Source
const DevTTY = "/dev/tty"

Variables

View Source
var ErrEmptyPath = errs.BadValue{
	What: "path", Valid: "non-empty string", Actual: "empty string"}

ErrEmptyPath is thrown by remove and remove-all when given an empty path.

View Source
var Ns = eval.BuildNsNamed("os").
	AddVars(map[string]vars.Var{
		"dev-null": vars.NewReadOnly(os.DevNull),
		"dev-tty":  vars.NewReadOnly(DevTTY),
	}).
	AddGoFns(map[string]any{
		"-is-exist":     isExist,
		"-is-not-exist": isNotExist,

		"mkdir":      mkdir,
		"mkdir-all":  mkdirAll,
		"symlink":    os.Symlink,
		"remove":     remove,
		"remove-all": removeAll,
		"rename":     os.Rename,
		"chmod":      chmod,

		"stat":       stat,
		"exists":     exists,
		"is-dir":     IsDir,
		"is-regular": IsRegular,

		"eval-symlinks": filepath.EvalSymlinks,

		"temp-dir":  TempDir,
		"temp-file": TempFile,
	}).Ns()

Ns is the Elvish namespace for this module.

Functions

func IsDir

func IsDir(opts statOpts, path string) bool

IsDir is exported so that the implementation may be shared by the path: module.

func IsRegular

func IsRegular(opts statOpts, path string) bool

IsRegular is exported so that the implementation may be shared by the path: module.

func TempDir

func TempDir(opts mktempOpt, args ...string) (string, error)

TempDir is exported so that the implementation may be shared by the path: module.

func TempFile

func TempFile(opts mktempOpt, args ...string) (*os.File, error)

TempFile is exported so that the implementation may be shared by the path: module.

Types

This section is empty.

Jump to

Keyboard shortcuts

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