Documentation ¶
Overview ¶
this file houses functions common to multiple commands
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AddCMD = cli.Command{ Name: "add", Usage: "add a tenet to lingo", Description: ` "lingo remove github.com/lingo-reviews/unused-args" `[1:], Flags: []cli.Flag{ cli.StringFlag{ Name: "driver", Value: "docker", Usage: "driver to use for this tenet", }, cli.StringFlag{ Name: "registry", Value: "hub.docker.com", Usage: "the registry this tenet should be pulled from", }, cli.StringFlag{ Name: "group", Value: "default", Usage: "group to add tenet to", }, cli.StringFlag{ Name: "options", Value: "", Usage: "a space separated list of key=value options", }, }, Action: add, BashComplete: func(c *cli.Context) { if len(c.Args()) > 0 { return } tenets, err := util.BinTenets() if err != nil { log.Printf("auto complete error %v", err) return } for _, t := range tenets { fmt.Println(t) } }, }
View Source
var ApplyPullCMD = cli.Command{ Name: "apply-pull", Aliases: []string{"a"}, Usage: "Checkout Pull Request", Description: "Checkout a remote and apply a PR to that remote, unstaging all changes", Action: applyPull, }
View Source
var BuildCMD = cli.Command{ Name: "build", Usage: "build a tenet from source", Description: ` Call "lingo build" in the root directory of the source code of a tenet. It will look for a .lingofile with instructions on how to build your tenet. For example: language = "go" owner = "lingoreviews" name = "simpleseed" [binary] build=false [docker] overwrite_dockerfile=true You can specify which driver to build. If no arguments are supplied, lingo will try to build every driver. `[1:], Flags: []cli.Flag{ cli.BoolFlag{ Name: "all", Usage: "build every tenet found in every subdirectory", }, }, Action: build, BashComplete: func(c *cli.Context) { if len(c.Args()) > 0 { return } for _, d := range allDrivers { util.Println(d) } }, }
View Source
var DocsCMD = cli.Command{
Name: "docs",
Usage: "output documentation generated from tenets",
Action: docs,
}
View Source
var EditCMD = cli.Command{ Name: "edit", Usage: "edit the .lingo file", Flags: []cli.Flag{ cli.StringFlag{ Name: "editor, e", Value: "vi", Usage: "editor to open config with", EnvVar: "LINGO_EDITOR", }, }, Action: edit, }
View Source
var GlobalOptions = []cli.Flag{ cli.StringFlag{ Name: repoPathFlg.String(), Value: ".", Usage: "the directory to operate in, defaults to current directory", EnvVar: "LINGO_REPO_PATH", }, cli.StringFlag{ Name: lingoHomeFlg.String(), Value: util.MustLingoHome(), Usage: "a directory of files needed for Lingo to operate e.g. logs and binary tenets are stored here", EnvVar: "LINGO_HOME", }, cli.StringFlag{ Name: tenetCfgFlg.String(), Value: defaultTenetCfgPath, Usage: "path to a .lingo to use. Defaults to " + defaultTenetCfgPath + " in current directory", EnvVar: "LINGO_TENET_CONFIG_NAME", }, }
View Source
var ImportCMD = cli.Command{ Name: "import", Usage: "import tenets from another lingo file", Description: ` Import all tenet's from a hosted .lingo file "lingo import github.com/waigani/juju.lingo" This command expects the import path to end in ".lingo". `[1:], Action: func(c *cli.Context) { fmt.Println("import not implemented") }, }
View Source
var InfoCMD = cli.Command{ Name: "info", Usage: "show information about a tenet", Description: ` "lingo info <tenet-name>" `[1:], Action: infoAction, BashComplete: func(c *cli.Context) { if len(c.Args()) > 0 { return } tenets, err := util.BinTenets() if err != nil { log.Printf("auto complete error %v", err) return } for _, t := range tenets { fmt.Println(t) } }, }
View Source
var InitCMD = cli.Command{
Name: "init",
Usage: "create a " + defaultTenetCfgPath + " config file in the current directory",
Action: initLingo,
}
View Source
var ListCMD = cli.Command{ Name: "list", Aliases: []string{"ls"}, Usage: "list tenets", Description: "Lists all tenets added to .lingo run.", Flags: []cli.Flag{ cli.BoolFlag{ Name: "installed", Usage: "list all tenets installed on this machine", }, }, Action: listAction, }
View Source
var OptionsCMD = cli.Command{
Name: "options",
Usage: "options <tenet-url>",
Description: "configure tenet options",
Action: options,
}
View Source
var PullCMD = cli.Command{ Name: "pull", Usage: "pull tenet image(s) from docker hub", Flags: []cli.Flag{ cli.BoolFlag{ Name: allFlg.String(), Usage: "pull all tenets in .lingo", }, cli.BoolFlag{ Name: updateFlg.String(), Usage: "look to pull a newer version", }, cli.StringFlag{ Name: registryFlg.String(), Value: "hub.docker.com", Usage: "the registry to pull from", }, cli.StringFlag{ Name: driverFlg.String(), Value: "docker", Usage: "the driver used to pull and run the tenet", }, }, Description: ` pull takes one argument, the name of the docker image or a --all flag. If the flag is provided, 0 arguments are expected and all tenets in .lingo are pulled. `[1:], Action: pull, }
View Source
var PushCMD = cli.Command{ Name: "push", Usage: "push a tenet to it's registry", Description: ` Call "lingo push" in the root directory of the source code of a tenet. It will look for a .lingofile with instructions on how where to push your tenet and what to call it. For example: owner = "lingoreviews" name = "simpleseed" registry = "hub.docker.com" At this stage only docker tenets can be pushed. `[1:], Flags: []cli.Flag{ cli.BoolFlag{ Name: "all", Usage: "push every tenet found in every subdirectory", }, }, Action: push, BashComplete: func(c *cli.Context) { if len(c.Args()) > 0 { return } for _, d := range allDrivers { util.Println(d) } }, }
View Source
var RemoveCMD = cli.Command{ Name: "remove", Aliases: []string{"rm"}, Usage: "remove a tenet from lingo", Description: ` "lingo remove github.com/lingo-reviews/unused-args" `[1:], Flags: []cli.Flag{ cli.StringFlag{ Name: "group", Value: "default", Usage: "group to remove tenet from"}, }, Action: remove, BashComplete: func(c *cli.Context) { if len(c.Args()) > 0 { return } tenets, err := util.BinTenets() if err != nil { log.Printf("auto complete error %v", err) return } for _, t := range tenets { fmt.Println(t) } }, }
View Source
var ReviewCMD = cli.Command{ Name: "review", Usage: "review code following tenets in .lingo", Description: ` Review all files found in pwd, following tenets in .lingo of pwd or parent directory: "lingo review" Review all files found in pwd, with two speific tenets: "lingo review \ lingoreviews/space-after-forward-slash \ lingoreviews/unused-args" This command ignores any tenets in any .lingo files. `[1:], Flags: []cli.Flag{ cli.StringFlag{ Name: "options", Usage: "serialized JSON options from .lingo", }, cli.StringFlag{ Name: "output", Value: "cli", Usage: "file path to write the output to. By default, output will be printed to the CLI", EnvVar: "LINGO-OUTPUT", }, cli.StringFlag{ Name: "output-fmt", Value: "none", Usage: "json or json-pretty", EnvVar: "LINGO-OUTPUT-FMT", }, cli.BoolFlag{ Name: "diff", Usage: "only report issues found in unstaged, uncommited work", EnvVar: "LINGO-DIFF", }, cli.BoolFlag{ Name: "keep-all", Usage: "turns off the default behaviour of stepping through each issue found and asking the user to confirm that it is an issue.", EnvVar: "LINGO-KEEP-ALL", }, cli.BoolFlag{ Name: "find-all", Usage: "raise every issue tenets find", EnvVar: "LINGO-KEEP-ALL", }, }, Action: reviewAction, }
View Source
var SearchCMD = cli.Command{ Name: "search", Usage: "search tenet image(s)", Flags: []cli.Flag{ cli.BoolFlag{ Name: tagsFlg.String(), }, }, Description: ` lingo search <tenet-name> --tags="list,of,tags,to,search" `[1:], Action: search, }
View Source
var SetupAutoCompleteCMD = cli.Command{
Name: "setup-auto-complete",
Usage: "setup auto completion lingo commands",
Description: `
This command appends the following line to the end of ~/.bashrc:
PROG=lingo source ~/.lingo_home/scripts/bash_autocomplete.sh
That line sources an auto-complete script for lingo. To complete the setup, run:
. ~/.bashrc
lingo --generate-bash-completion
`[1:],
Action: sourceAutoComplete,
}
View Source
var ValidateCMD = cli.Command{
Name: "validate",
Usage: "validate a tenet",
Description: `
"lingo validate <author>/<tenet>"
`[1:],
Action: validate,
}
View Source
var WhichCMD = cli.Command{
Name: "which",
Usage: "prints path to .lingo",
Description: "prints path to .lingo",
Action: which,
}
View Source
var WriteDocCMD = cli.Command{ Name: "write-docs", Usage: "write documentation generated from tenets to a file", Flags: []cli.Flag{ cli.StringFlag{ Name: "template, t", Value: "", Usage: "path to template file", EnvVar: "LINGO_DOC_TEMPLATE", }, cli.StringFlag{ Name: "output, o", Value: "lingo_docs/tenets.md", Usage: "file to write the output to. By default, output file is lingo_docs/tenets.md", }, }, Action: writeDoc, }
Functions ¶
func FindLingoCfg ¶
func FindLingoCfg()
Types ¶
type CascadeDirection ¶
type CascadeDirection int
const ( CascadeNone CascadeDirection = iota // Only read config in the current working directory CascadeUp // Walk up parent directories and include found tenets CascadeDown // Search subdirectories recursively and include found tenets CascadeBoth // Combine CascadeUp and CascadeDown )
Down and Both are intended to be used only with specific commands, and not exposed to the CLI user
func (CascadeDirection) String ¶
func (c CascadeDirection) String() string
Return a string representation of a CascadeDirection
type TenetConfig ¶
type TenetConfig struct { Name string `toml:"name"` // Name of the driver in use Driver string `toml:"driver"` // Registry server to pull the image from Registry string `toml:"registry"` // Tag server to pull the image from Tag string `toml:"tag"` // TODO(waigani) if we don't need this to pull, get rid of it. // Config options for tenet Options map[string]interface{} `toml:"options"` }
type TenetGroup ¶
type TenetGroup struct { Name string `toml:"name"` Template string `toml:"template"` Tenets []TenetConfig `toml:"tenet"` }
Source Files ¶
- add.go
- applypull.go
- build.go
- buildbinary.go
- builddocker.go
- common.go
- docs.go
- edit.go
- globalbeforecommand.go
- globaloptions.go
- import.go
- info.go
- init.go
- list.go
- options.go
- pull.go
- push.go
- remove.go
- review.go
- search.go
- setautocomplete.go
- tenet.go
- tenetcommands.go
- validate.go
- web.go
- which.go
- write_doc.go
Click to show internal directories.
Click to hide internal directories.