{"modulePath":"github.com/LeaflowNET/leaflow","version":"v0.3.0","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package cli\n\nPackage cli assembles the kernel, the contracts and the extensions into one program. It is the only package that knows about all of them: spec knows nothing of cobra, and transport nothing of the command tree.\n\n## Constants\n\n```go\nconst (\n\tExitOK = 0\n\n\t// ExitError is anything not classified below.\n\tExitError = 1\n\n\t// ExitUsage is a malformed command line: unknown flag, wrong arity.\n\tExitUsage = 2\n\n\t// ExitAuth means no usable credentials. Retrying without logging in again\n\t// cannot help.\n\tExitAuth = 3\n\n\t// ExitPermission means the identity is fine but not allowed.\n\tExitPermission = 4\n\n\tExitNotFound = 5\n\n\t// ExitValidation is a local failure: the request was never sent.\n\tExitValidation = 6\n\n\t// ExitAPI is a service-side refusal that is none of the above.\n\tExitAPI = 7\n\n\t// ExitInterrupted follows the shell convention of 128 + SIGINT.\n\tExitInterrupted = 130\n)\n```\nExit codes are part of the CLI's contract, because this tool is meant to be wrapped by other programs. A caller has to be able to tell \"log in again\" from \"you cannot do that\" from \"the service is down\" without parsing prose.\n\n## Functions\n\n```go\nfunc Execute(args []string) int\n```\n\n## Types\n\n```go\ntype App struct {\n\tOut io.Writer\n\tErr io.Writer\n\tIn  io.Reader\n\t// contains filtered or unexported fields\n}\n```\nApp is one run's state. Keeping it in a struct rather than package variables lets tests build several that do not leak flags into each other.\n\n```go\nfunc (a *App) Root() (*cobra.Command, error)\n```\n\n```go\nfunc (a *App) Run(args []string) int\n```\n\n```go\ntype Failure struct {\n\t// Kind is the coarse category, matching the exit code.\n\tKind string `json:\"kind\"`\n\n\t// Code is the service's own error code (NOT_A_MEMBER, TOKEN_EXPIRED) when\n\t// there is one. This is contract; Message is not.\n\tCode string `json:\"code,omitempty\"`\n\n\tStatus int `json:\"status,omitempty\"`\n\n\tMessage string `json:\"message\"`\n\n\t// Problems carries every validation failure, since they are reported\n\t// together rather than one per run.\n\tProblems []string `json:\"problems,omitempty\"`\n\n\t// Hint is the next action, when there is an obvious one.\n\tHint string `json:\"hint,omitempty\"`\n\n\tExitCode int `json:\"exit_code\"`\n}\n```\nFailure is the machine-readable form of an error, emitted under -o json and -o yaml so a wrapping program gets a parseable object instead of a sentence.\n\n","path":"github.com/LeaflowNET/leaflow/internal/cli","name":"cli","synopsis":"Package cli assembles the kernel, the contracts and the extensions into one program.","isRedistributable":true}
