Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
Marshal returns the Starlark encoding of v.
Marshal traverses the value v recursively using the following type-dependent default encodings:
Boolean values are encoded as True/False. Strings values are encoded as quoted Starlark strings. Array and slice values are encoded as Starlark lists, with their contents recursively encoded. Nil pointer values are encoded as None.
Types ¶
type ArgumentLiterals ¶
type ArgumentLiterals []string
ArgumentLiterals represents a list of literal positional argument and is written to support the marshalling in WriteCommand.
func (ArgumentLiterals) MarshalStarlark ¶
func (al ArgumentLiterals) MarshalStarlark() ([]byte, error)
MarshalStarlark implements Marshaler.
type Marshaler ¶
Marshaler is the interface implemented by types that can marshal themselves into valid Starlark.
type StarlarkWriter ¶
type StarlarkWriter struct {
// contains filtered or unexported fields
}
StarlarkWriter is a simple type for writing basic Starlark macros with a consistent form.
func NewStarlarkWriter ¶
func NewStarlarkWriter(w io.Writer) *StarlarkWriter
NewStarlarkWriter creates a new StarlarkWriter writing to the provided output.
func (*StarlarkWriter) BeginMacro ¶
func (sw *StarlarkWriter) BeginMacro(name string) error
BeginMacro starts writing a new macro with the given name.
func (*StarlarkWriter) EndMacro ¶
func (sw *StarlarkWriter) EndMacro() error
EndMacro ends writing the current macro; flushing any pending output.
func (*StarlarkWriter) PopDirectory ¶
func (sw *StarlarkWriter) PopDirectory() (string, error)
PopDirectory writes a Starlark directive indicating that the directory has been exited and to restore the previous context.
func (*StarlarkWriter) PushDirectory ¶
func (sw *StarlarkWriter) PushDirectory(path string) error
PushDirectory writes a Starlark directive indicating a new directory context should be used in the given path.
func (*StarlarkWriter) WriteCommand ¶
func (sw *StarlarkWriter) WriteCommand(cmd string, args ...interface{}) error
WriteCommand writes an invocation of the provided command and arguments.