cmdexec

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package `cmdexec` provides a facility to execute l2 commands, stream output to stdout, while also providing ability to retrieve the command output as a string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecCommand

func ExecCommand(cmdSlice []string, stdinBody string, apiDir string) (httpie.ExResponse, error)

ExecCommand changes directory to the given `apiDir` and then executes the command specified in `cmdStr` During command execution, ExecCommand streams output to stdout. Once execution finishes, previous CWD is restored, and the command output is returned as a string

func GenerateChainCode added in v1.3.0

func GenerateChainCode(httpRespBody string) string

GenerateChainCode takes in an HTTP response body and comes up with some JS code to define the "magic variable" result. What does the code do? The result is stored as a JS object, if the input value can be parsed as JSON. Otherwise the value is stored as a simple string.

func GetJSVm added in v1.3.0

func GetJSVm() *goja.Runtime

GetJSVm creates a new goja runtime instance with console.log enabled

func RunVMCode added in v1.3.0

func RunVMCode(jsCode string, vm *goja.Runtime)

RunVMCode takes in a JS snippet as a string, executes the code in a JS VM, finally checks whether there are any errors, and if yes, logs the problem. Note: the vm runtime remains modified; so if you reuse the vm for other operations, the state from previous invocations carry over

Types

This section is empty.

Jump to

Keyboard shortcuts

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