Documentation ¶
Overview ¶
Package os provides variadic function definitions for IO/OS builtins.
Index ¶
- func NewStdHandle(f *os.File) goal.V
- func VFChdir(ctx *goal.Context, args []goal.V) goal.V
- func VFClose(ctx *goal.Context, args []goal.V) goal.V
- func VFEnv(ctx *goal.Context, args []goal.V) goal.V
- func VFFlush(ctx *goal.Context, args []goal.V) goal.V
- func VFImport(ctx *goal.Context, args []goal.V) goal.V
- func VFOpen(ctx *goal.Context, args []goal.V) goal.V
- func VFPrint(ctx *goal.Context, args []goal.V) goal.V
- func VFRead(ctx *goal.Context, args []goal.V) goal.V
- func VFRun(ctx *goal.Context, args []goal.V) goal.V
- func VFSay(ctx *goal.Context, args []goal.V) goal.V
- func VFShell(ctx *goal.Context, args []goal.V) goal.V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStdHandle ¶ added in v0.9.0
NewStdHandle returns a buffered handle for the given file.
func VFChdir ¶ added in v0.10.0
VFChdir implements the chdir monad.
chdir s : change current directory to s, or return an error
It returns a true value on success.
func VFClose ¶ added in v0.10.0
VFClose implements the close monad.
close h : closes a filehandle.
It returns a true value on success, and an error otherwise.
func VFEnv ¶ added in v0.10.0
VFEnv implements the os.env dyad.
env s : retrieve environment variable s, or return an error if unset. As a special case, "" returns a dictionary representing the whole environment.
x env s : sets the value of the environment variable x to s. It returns a true value of success, and an error otherwise. Also, the special form env[x;0] unsets a variable, and as a special case, env["";0] clears the whole environment.
func VFFlush ¶ added in v0.10.0
VFFlush implements the flush monad.
flush h : flushes any buffered data to h.
It returns a true value on success.
func VFImport ¶ added in v0.10.0
VFImport implements the import dyad.
import s : evaluate file s+".goal" (or s if it has already an extension) with prefix s (without extension) for globals.
x import s : same as import s but use prefix x. If x is empty, no prefix is used.
It returns 0 and does nothing if a file has already been evaluated.
func VFOpen ¶ added in v0.10.0
VFOpen implements the open dyad.
open "path" : opens file "path" for reading.
x open "path" : opens file "path" using the given fopen(3) mode x.
x can be: "r", "r+", "w", "w+", "a", "a+", "|-", "-|". In the last two modes, the path is instead interpreted as a command, and can be a list of strings.
It returns a filehandle value of type "h" on success, and an error otherwise.
func VFPrint ¶ added in v0.10.0
VFPrint implements the print dyad.
print x : outputs x to standard output. It returns a true value on success.
x print y : outputs y to x, where x is an io.Writer handle or a filename (goal.S).
func VFRead ¶ added in v0.10.0
VFRead implements the read dyad.
read h : reads from filehandle h until EOF or an error occurs.
read s : reads file named s
s read h : reads from filehandle h until delimiter s or EOF, or an error occurs.
i read h : reads i bytes from filehandle h until EOF (returning possibly less than i bytes) or an error occurs.
It returns the read content as a string on success, and an error otherwise.
func VFRun ¶ added in v0.10.0
VFRun implements the run monad.
run s : run command s, with arguments if s is an array.
x run s : run command s, with input string x.
In the first form, standard input, output, and error are inherited from the parent. It returns a true value on success, and an error otherwise.
In the second form, only standard error is inherited, and the command's standard output is returned.
Types ¶
This section is empty.