cmds

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DocsCmd = &cobra.Command{
	Use:   "docs [flags] file [file...]",
	Short: "Work with help documents",
	Args:  cobra.MinimumNArgs(1),
	Run: func(cmd *cobra.Command, args []string) {
		ctx := cmd.Context()
		gp, _, err := cli.CreateGlazedProcessorFromCobra(cmd)
		cobra.CheckErr(err)

		for _, arg := range args {

			s, err := os.ReadFile(arg)
			cobra.CheckErr(err)

			var metaData types.Row
			inputReader := bytes.NewReader(s)
			_, err = frontmatter.Parse(inputReader, &metaData)
			cobra.CheckErr(err)

			metaData.Set("path", arg)

			err = gp.AddRow(ctx, metaData)
			cobra.CheckErr(err)
		}

		err = gp.Close(ctx)
		if _, ok := err.(*cmds.ExitWithoutGlazeError); ok {
			os.Exit(0)
		}
		cobra.CheckErr(err)
	},
}
View Source
var MarkdownCmd = &cobra.Command{
	Use:   "markdown",
	Short: "Convert markdown data",
}

Functions

This section is empty.

Types

type CsvCommand added in v0.2.25

type CsvCommand struct {
	*cmds.CommandDescription
}

func NewCsvCommand added in v0.2.25

func NewCsvCommand() (*CsvCommand, error)

func (*CsvCommand) RunIntoGlazeProcessor added in v0.4.36

func (c *CsvCommand) RunIntoGlazeProcessor(ctx context.Context, parsedLayers *layers.ParsedLayers, gp middlewares.Processor) error

type CsvSettings added in v0.4.36

type CsvSettings struct {
	InputFiles       []string `glazed.parameter:"input-files"`
	Delimiter        string   `glazed.parameter:"delimiter"`
	Comment          string   `glazed.parameter:"comment"`
	FieldsPerRecord  int      `glazed.parameter:"fields-per-record"`
	TrimLeadingSpace bool     `glazed.parameter:"trim-leading-space"`
	LazyQuotes       bool     `glazed.parameter:"lazy-quotes"`
}

type ExampleCommand added in v0.3.8

type ExampleCommand struct {
	*cmds.CommandDescription
}

func NewExampleCommand added in v0.3.8

func NewExampleCommand() (*ExampleCommand, error)

func (*ExampleCommand) RunIntoGlazeProcessor added in v0.4.36

func (c *ExampleCommand) RunIntoGlazeProcessor(ctx context.Context, parsedLayers *layers.ParsedLayers, gp middlewares.Processor) error

RunIntoGlazeProcessor is called to actually execute the command.

parsedLayers contains the result of parsing each layer that has been registered with the command description. These layers can be glazed structured data flags, database connection parameters, application specification parameters.

ps is a convenience map containing *all* parsed flags.

gp is a GlazeProcessor that can be used to emit rows. Each row is an ordered map.

type ExampleSettings added in v0.4.36

type ExampleSettings struct {
	Count int  `glazed.parameter:"count"`
	Test  bool `glazed.parameter:"test"`
}

type ExtensionFlag

type ExtensionFlag struct {
	FlagName string
	FlagDesc string
	Extender goldmark.Extender
}

type JsonCommand added in v0.2.10

type JsonCommand struct {
	*cmds.CommandDescription
}

func NewJsonCommand added in v0.2.10

func NewJsonCommand() (*JsonCommand, error)

func (*JsonCommand) RunIntoGlazeProcessor added in v0.4.36

func (j *JsonCommand) RunIntoGlazeProcessor(ctx context.Context, parsedLayers *layers.ParsedLayers, gp middlewares.Processor) error

type JsonSettings added in v0.4.36

type JsonSettings struct {
	InputIsArray bool     `glazed.parameter:"input-is-array"`
	Sanitize     bool     `glazed.parameter:"sanitize"`
	FromMarkdown bool     `glazed.parameter:"from-markdown"`
	InputFiles   []string `glazed.parameter:"input-files"`
}

type YamlCommand added in v0.2.10

type YamlCommand struct {
	*cmds.CommandDescription
}

func NewYamlCommand added in v0.2.10

func NewYamlCommand() (*YamlCommand, error)

func (*YamlCommand) RunIntoGlazeProcessor added in v0.4.36

func (y *YamlCommand) RunIntoGlazeProcessor(ctx context.Context, parsedLayers *layers.ParsedLayers, gp middlewares.Processor) error

type YamlSettings added in v0.4.36

type YamlSettings struct {
	InputIsArray bool     `glazed.parameter:"input-is-array"`
	Sanitize     bool     `glazed.parameter:"sanitize"`
	FromMarkdown bool     `glazed.parameter:"from-markdown"`
	InputFiles   []string `glazed.parameter:"input-files"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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