Documentation ¶
Index ¶
- Constants
- Variables
- func DecoratorArgs(decStr string) []string
- func ErrFanIn(err1c, err2c chan error) chan error
- func GitCMD(args ...string) (out string, err error)
- func HandleErr(err error)
- func MarshalChan(replyc chan *grpcflow.Reply, newItem func() proto.Message, ...) (chan proto.Message, chan error)
- func NewCtx(app *cli.App, input ...string) (*cli.Context, error)
- func NewFlow(cliApp *CLIApp, decoratorApp *DecoratorApp) *flowRunner
- func NoCommitErr(err error) bool
- func OpenFileConfirmAction(filename string, line int64) (bool, bool, error)
- func ParseArgs(args []string) string
- func ReadDotLingo(ctx *cli.Context) (string, error)
- func Request(ctx context.Context, reqC <-chan *grpcflow.Request) (chan *grpcflow.Reply, chan error, error)
- func RunFlow(flowName string, req proto.Message, newItem func() proto.Message, ...) (chan proto.Message, <-chan *UserVar, chan error, func(), error)
- type CLIApp
- type ConfirmerItem
- type DecoratedResult
- type DecoratorApp
- type UserVar
Constants ¶
const NoCommitErrMsg = "" /* 219-byte string literal not displayed */
TODO(waigani) this should live under the VCS domain, not Flows
Variables ¶
var CLIAPPHELPTMP = `
--- {{.Tagline}} - https://codelingo.io/flows/codelingo/{{.Name}} ---
FLOW HELP
=========
{{.Usage}}
USAGE
-----
$ lingo run {{.Name}} [options]
OPTIONS
-------
{{range .VisibleFlags}}
{{.}}
{{end}}
`[1:]
var DECAPPHELPTMP = `
DECORATOR HELP
==============
USAGE
-----
@{{.Name}} {{.DecoratorUsage}}
{{if len .VisibleFlags}}
OPTIONS
-------
{{range .VisibleFlags}}
{{.}}
{{end}}
{{end}}
EXAMPLE
-------
# codelingo.yaml file
tenets:
- name: example-tenet
flows:
codelingo/{{.Name}}:
query:
import codelingo/ast/go
@{{.Name}} {{.DecoratorExample}}
go.func_decl(depth := any)
`[1:]
var INFOTMP = `
FLOW APP INFO
=============
Version
-------
{{.Version}} - last compiled {{.Compiled}}
{{if len .Authors}}
AUTHOR
------
{{range .Authors}}{{ . }}{{end}}
{{end}}
`[1:]
Functions ¶
func DecoratorArgs ¶
DecoratorArgs parses a decorator string and returns the CLI arguments
func MarshalChan ¶
func NewFlow ¶
func NewFlow(cliApp *CLIApp, decoratorApp *DecoratorApp) *flowRunner
NewFlow creates a flowRunner from a CLIApp. For flows that query the flow server it overrides the action with command function, which runs the cliApp's Request function and listens on the channels it returns. TODO: move away from flowRunner model by explicitly defining the command function as the action in the flow.
func OpenFileConfirmAction ¶
func ParseArgs ¶
ParseArgs formats args for urfave/cli urfave/cli doesn't distinguish between literal and variable args e.g. "this arg" vs thisArg. "this arg" gets parsed as two args. The function below takes all args as the input. The cli lib pads {} chars which we undo below. A better cli lib should be used.
func ReadDotLingo ¶
Read a codelingo.yaml file from a filepath argument
Types ¶
type ConfirmerItem ¶
type ConfirmerItem struct { Preview func() string // Options is a map of option keys to confirm functions. Each confirm function returns: <keep>bool, <retry>bool, <err>error Options map[string]func() (bool, bool, error) // OptionKeyMap maps an option key to aliases e.g. "[k]eep" => "k", "keep", "K" OptionKeyMap map[string][]string // FlagOptions is a map of flags to options show if that flag is present. // "_all" is a builtin flag for those options that don't require a flag. FlagOptions map[string][]string // contains filtered or unexported fields }
type DecoratedResult ¶
type DecoratorApp ¶
type UserVar ¶
A UserVar allows users and other external agents to set variable values while a query is being executed. TODO: UserVar code is copied from the Platform
func (*UserVar) SetAsDefault ¶
func (s *UserVar) SetAsDefault()
SetAsDefault sets the variable to its default value