cmd

package
v0.0.0-...-8e482eb Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

The claat command generates one or more codelabs from "source" documents, specified as either Google Doc IDs or local markdown files. The command also allows one to preview generated codelabs from local drive using "claat serve". See more details at https://github.com/Noname-SA/claat-tool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CmdExport

func CmdExport(opts CmdExportOptions) int

CmdExport is the "claat export ..." subcommand. It returns a process exit code.

func CmdServe

func CmdServe(addr string) int

CmdServe is the "claat serve ..." subcommand. addr is the hostname and port to bind the web server to. It returns a process exit code.

func CmdUpdate

func CmdUpdate(opts CmdUpdateOptions) int

CmdUpdate is the "claat update ..." subcommand. It returns a process exit code.

func ExportCodelab

func ExportCodelab(src string, rt http.RoundTripper, opts CmdExportOptions) (*types.Meta, error)

ExportCodelab fetches codelab src from either local disk or remote, parses and stores the results on disk, in a dir ancestored by output.

Stored results include codelab content formatted in tmplout, its assets and metadata in JSON format.

There's a special case where basedir has a value of "-", in which nothing is stored on disk and the only output, codelab formatted content, is printed to stdout.

An alternate http.RoundTripper may be specified if desired. Leave null for default.

func ExportCodelabMemory

func ExportCodelabMemory(src io.ReadCloser, w io.Writer, opts CmdExportOptions) (*types.Meta, error)

Types

type CmdExportOptions

type CmdExportOptions struct {
	// AuthToken is the token to use for the Drive API.
	AuthToken string
	// Expenv is the codelab environment to export to.
	Expenv string
	// ExtraVars is extra template variables.
	ExtraVars map[string]string
	// GlobalGA is the global Google Analytics account to use.
	GlobalGA string
	// Output is the output directory, or "-" for stdout.
	Output string
	// PassMetadata are the extra metadata fields to pass along.
	PassMetadata map[string]bool
	// Prefix is a URL prefix to prepend when using HTML format.
	Prefix string
	// Srcs is the sources to export codelabs from.
	Srcs []string
	// Tmplout is the output format.
	Tmplout string
}

Options type to make the CmdExport signature succinct.

type CmdUpdateOptions

type CmdUpdateOptions struct {
	// AuthToken is the token to use for the Drive API.
	AuthToken string
	// ExtraVars is extra template variables.
	ExtraVars map[string]string
	// GlobalGA is the global Google Analytics account to use.
	GlobalGA string
	// PassMetadata are the extra metadata fields to pass along.
	PassMetadata map[string]bool
	// Prefix is a URL prefix to prepend when using HTML format.
	Prefix string
}

Options type to make the CmdUpdate signature succinct.

Jump to

Keyboard shortcuts

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