{"modulePath":"github.com/azure/azure-dev/cli/azd","version":"v1.40.0","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package scripting\n\nPackage scripting provides secure script and command execution with Azure context.\n\n## Functions\n\n```go\nfunc DefaultShell() string\n```\nDefaultShell returns the platform-appropriate default shell.\n\n```go\nfunc DetectShellFromFile(filePath string) string\n```\nDetectShellFromFile returns the appropriate shell for executing a script file based on its extension.\n\n```go\nfunc IsSupportedShell(shell string) bool\n```\nIsSupportedShell returns whether the given shell name is a supported shell.\n\n```go\nfunc ValidateShell(shell string) error\n```\nValidateShell checks whether shell is a known, supported shell name. An empty string is considered valid (auto-detect).\n\n## Types\n\n```go\ntype Config struct {\n\tShell       string\n\tInteractive bool\n\tArgs        []string\n\t// Env overrides the child process environment. When set, the child process\n\t// receives exactly these variables instead of inheriting os.Environ().\n\t// This prevents secrets from leaking into the parent process via os.Setenv.\n\tEnv []string\n}\n```\nConfig holds the configuration for script execution.\n\n```go\nfunc (c *Config) Validate() error\n```\nValidate checks if the Config has valid values.\n\n```go\ntype ExecutionError struct {\n\tExitCode int\n\tShell    string\n\tIsInline bool\n}\n```\nExecutionError indicates that script execution failed with a specific exit code.\n\n```go\nfunc (e *ExecutionError) Error() string\n```\n\n```go\nfunc (e *ExecutionError) Interrupted() bool\n```\nInterrupted reports whether script execution ended because of Ctrl+C.\n\n```go\ntype Executor struct {\n\t// contains filtered or unexported fields\n}\n```\nExecutor executes scripts and commands with azd context.\n\n```go\nfunc New(config Config) (*Executor, error)\n```\nNew creates a new script executor with the given configuration.\n\n```go\nfunc (e *Executor) Execute(ctx context.Context, scriptPath string) error\n```\nExecute runs a script file.\n\n```go\nfunc (e *Executor) ExecuteDirect(ctx context.Context, command string, args []string) error\n```\nExecuteDirect runs a command directly without shell wrapping, preserving exact argv semantics. This is the preferred mode for \"run a program with azd env\".\n\n```go\nfunc (e *Executor) ExecuteInline(ctx context.Context, scriptContent string) error\n```\nExecuteInline runs an inline script command.\n\n```go\ntype InvalidShellError struct {\n\tShell string\n}\n```\nInvalidShellError indicates that an invalid shell was specified.\n\n```go\nfunc (e *InvalidShellError) Error() string\n```\n\n```go\ntype ScriptNotFoundError struct {\n\tPath string\n}\n```\nScriptNotFoundError indicates that a script file could not be found.\n\n```go\nfunc (e *ScriptNotFoundError) Error() string\n```\n\n```go\ntype ValidationError struct {\n\tField  string\n\tReason string\n\tErr    error\n}\n```\nValidationError indicates that input validation failed.\n\n```go\nfunc (e *ValidationError) Error() string\n```\n\n```go\nfunc (e *ValidationError) Unwrap() error\n```\nUnwrap returns the underlying validation cause, if any.\n\n","path":"github.com/azure/azure-dev/cli/azd/pkg/exec/scripting","name":"scripting","synopsis":"Package scripting provides secure script and command execution with Azure context.","isRedistributable":true}
