Download internal/shell/doc.go from SaylorTwift/crush: direct link, hf CLI and curl.
- Browser
- Download file 646 Bytes
-
https://huggingface.co/SaylorTwift/crush/resolve/main/internal/shell/doc.go
- Command line
-
hf download hf://SaylorTwift/crush/internal/shell/doc.go
-
curl -L -o doc.go https://huggingface.co/SaylorTwift/crush/resolve/main/internal/shell/doc.go
646 Bytes
| package shell | |
| // Example usage of the shell package: | |
| // | |
| // 1. For one-off commands: | |
| // | |
| // shell := shell.NewShell(nil) | |
| // stdout, stderr, err := shell.Exec(context.Background(), "echo hello") | |
| // | |
| // 2. For maintaining state across commands: | |
| // | |
| // shell := shell.NewShell(&shell.Options{ | |
| // WorkingDir: "/tmp", | |
| // Logger: myLogger, | |
| // }) | |
| // shell.Exec(ctx, "export FOO=bar") | |
| // shell.Exec(ctx, "echo $FOO") // Will print "bar" | |
| // | |
| // 3. Managing environment and working directory: | |
| // | |
| // shell := shell.NewShell(nil) | |
| // shell.SetEnv("MY_VAR", "value") | |
| // shell.SetWorkingDir("/tmp") | |
| // cwd := shell.GetWorkingDir() | |
| // env := shell.GetEnv() | |