commands

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Groups = []kong.Group{
	{
		Key:   "filtering",
		Title: "Filtering options",
	},
	{
		Key:   "output",
		Title: "Output formatting options",
	},
}

Functions

func Main

func Main() int

func MakeParser

func MakeParser(opts ...kong.Option) (*kong.Kong, error)

Types

type CLI

type CLI struct {
	Ls            LsCmd            `cmd:"" aliases:"list" help:"List types, fields, or directives in a GraphQL SDL document."`
	Json          JsonCmd          `cmd:"" help:"Return a JSON representation of a GraphQL SDL document."`
	Introspection IntrospectionCmd `cmd:"" help:"Interact with a GraphQL introspection endpoint over HTTP."`
	Viz           VizCmd           `cmd:"" help:"Visualize a GraphQL schema using GraphViz."`
	Merge         MergeCmd         `cmd:"" help:"Merge multiple GraphQL SDL documents into a single one."`
	VersionFlag   versionFlag      `hidden:"" help:"Print version and exit."`
	Version       VersionCmd       `cmd:"" help:"Print the version of gquil and exit."`
}

type Context

type Context struct {
	Stdout io.Writer
	Stderr io.Writer
	Stdin  io.Reader
}

func (Context) Print

func (c Context) Print(s string)

func (Context) PrintJson

func (c Context) PrintJson(v any) error

func (Context) Printf

func (c Context) Printf(fs string, args ...any)

type EmitQueryCmd

type EmitQueryCmd struct {
	Json bool `name:"json" help:"Emit the query as JSON, suitable for passing to curl or similar."`
	SpecVersionOptions
}

func (*EmitQueryCmd) Run

func (c *EmitQueryCmd) Run(ctx Context) error

type FilteringOptions

type FilteringOptions struct {
	IncludeBuiltins bool `name:"include-builtins" group:"filtering" help:"Include built-in types and directives in output (omitted by default)."`
}

type GenerateSDLCmd

type GenerateSDLCmd struct {
	Endpoint string   `arg:"" help:"The GraphQL introspection endpoint URL to fetch from."`
	Headers  []string `` /* 259-byte string literal not displayed */
	Trace    bool     `name:"trace" help:"Dump the introspection HTTP request and response to stderr for debugging."`

	OutputOptions
	SpecVersionOptions
	FilteringOptions
}

func (*GenerateSDLCmd) Help

func (c *GenerateSDLCmd) Help() string

func (*GenerateSDLCmd) Run

func (c *GenerateSDLCmd) Run(ctx Context) error

type GraphFilteringOptions

type GraphFilteringOptions struct {
	From  []string `` /* 160-byte string literal not displayed */
	Depth int      `name:"depth" group:"filtering" help:"When used with --from, limit the depth of traversal."`
}

type IncludeDirectivesOption

type IncludeDirectivesOption struct {
	IncludeDirectives bool `` /* 127-byte string literal not displayed */
}

type InputOptions

type InputOptions struct {
	// TODO: stdin support
	SchemaFiles []string `arg:"" name:"schemas" help:"Path to the GraphQL SDL schema file(s) to read from."`
}

type IntrospectionCmd

type IntrospectionCmd struct {
	GenerateSDL GenerateSDLCmd `cmd:"" help:"Generate GraphQL SDL from a GraphQL introspection endpoint over HTTP(S)."`
	Query       EmitQueryCmd   `cmd:"" help:"Emit the GraphQL query used for introspection."`
}

type JsonCmd

func (*JsonCmd) Help

func (c *JsonCmd) Help() string

func (*JsonCmd) Run

func (c *JsonCmd) Run(ctx Context) error

type LsCmd

type LsCmd struct {
	Types      LsTypesCmd      `cmd:"" help:"List types in the given schema(s)."`
	Fields     LsFieldsCmd     `cmd:"" help:"List fields in the given schema(s)."`
	Directives LsDirectivesCmd `cmd:"" help:"List directive definitions in the given schema(s)."`
}

type LsDirectivesCmd

type LsDirectivesCmd struct {
	InputOptions
	FilteringOptions
	OutputOptions
}

func (LsDirectivesCmd) Help added in v0.2.0

func (c LsDirectivesCmd) Help() string

func (LsDirectivesCmd) Run

func (c LsDirectivesCmd) Run(ctx Context) error

type LsFieldsCmd

type LsFieldsCmd struct {
	InputOptions
	OnType        string `name:"on-type" group:"filtering" help:"Only include fields which appear on the specified type."`
	OfType        string `` /* 200-byte string literal not displayed */
	ReturningType string `` /* 266-byte string literal not displayed */
	Named         string `` /* 141-byte string literal not displayed */
	IncludeArgs   bool   `name:"include-args" group:"output" help:"Include argument definitions in human-readable output. Has no effect with --json."`
	IncludeDirectivesOption
	OutputOptions
	FilteringOptions
	GraphFilteringOptions
}

func (LsFieldsCmd) Help added in v0.2.0

func (c LsFieldsCmd) Help() string

func (LsFieldsCmd) Run

func (c LsFieldsCmd) Run(ctx Context) error

type LsTypesCmd

type LsTypesCmd struct {
	InputOptions
	Kind       ast.DefinitionKind `` /* 126-byte string literal not displayed */
	MemberOf   string             `name:"member-of" group:"filtering" help:"Only list types which are members of the given union."`
	Implements string             `name:"implements" group:"filtering" help:"Only list types which implement the given interface."`
	IncludeDirectivesOption
	FilteringOptions
	OutputOptions
	GraphFilteringOptions
}

func (LsTypesCmd) Help added in v0.2.0

func (c LsTypesCmd) Help() string

func (LsTypesCmd) Run

func (c LsTypesCmd) Run(ctx Context) error

type MergeCmd

type MergeCmd struct {
	InputOptions
	FilteringOptions
}

func (*MergeCmd) Run

func (c *MergeCmd) Run(ctx Context) error

type OutputOptions

type OutputOptions struct {
	Json bool `name:"json" group:"output" help:"Output results as JSON."`
}

type SpecVersionOptions

type SpecVersionOptions struct {
	SpecVersion string `` /* 369-byte string literal not displayed */
}

type VersionCmd added in v0.1.7

type VersionCmd struct {
}

func (VersionCmd) Run added in v0.1.7

func (c VersionCmd) Run(ctx Context) error

type VizCmd

type VizCmd struct {
	InputOptions
	FilteringOptions
	GraphFilteringOptions
	InterfacesAsUnions bool `name:"interfaces-as-unions" help:"Treat interfaces as unions rather than objects for the purposes of graph construction."`
}

func (*VizCmd) Help added in v0.2.0

func (c *VizCmd) Help() string

func (*VizCmd) Run

func (c *VizCmd) Run(ctx Context) error

Jump to

Keyboard shortcuts

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