cli

package
v0.0.51 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: Apache-2.0, NCSA Imports: 33 Imported by: 1

Documentation

Overview

Package cli exposes a CLI interface to the Kythe services.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultFileCorpus is the --corpus flag used by source/decor/diagnostics
	// commands to construct a file ticket from a raw file path.
	DefaultFileCorpus string

	// DefaultFileRoot is the --root flag used by source/decor/diagnostics commands
	// to construct a file ticket from a raw file path.
	DefaultFileRoot string

	// DefaultFilePathPrefix is the --path_prefix flag used by
	// source/decor/diagnostics commands to construct a file ticket from a raw file
	// path.
	DefaultFilePathPrefix string
)
View Source
var DisplayJSON bool

DisplayJSON is true if the user wants all service responses to be displayed as JSON (using the PrintJSON and PrintJSONMessage functions).

Functions

func Execute

func Execute(ctx context.Context, api API) subcommands.ExitStatus

Execute registers all Kythe CLI commands to subcommands.DefaultCommander and executes it with the given API.

func LogRequest

func LogRequest(req proto.Message)

LogRequest should be passed all proto request messages for logging.

func PrintJSON

func PrintJSON(val interface{}) error

PrintJSON prints the given value to the console. This should be called whenever the DisplayJSON flag is true. PrintJSONMessage should be preferred when possible.

func PrintJSONMessage

func PrintJSONMessage(resp proto.Message) error

PrintJSONMessage prints the given proto message to the console. This should be called whenever the DisplayJSON flag is true.

func RegisterCommand

func RegisterCommand(c KytheCommand, group string)

RegisterCommand adds a KytheCommand to the list of subcommands for the specified group.

Types

type API

type API struct {
	XRefService       xrefs.Service
	GraphService      graph.Service
	FileTreeService   filetree.Service
	IdentifierService identifiers.Service
}

API contains access points the CLI's backend services.

type KytheCommand

type KytheCommand interface {
	Name() string
	Synopsis() string
	Usage() string
	SetFlags(*flag.FlagSet)
	Run(context.Context, *flag.FlagSet, API) error
}

A KytheCommand is a type-safe version of the subcommands.Command interface.

Jump to

Keyboard shortcuts

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