Documentation ¶
Index ¶
- Variables
- func AddCommands(c *flags.Command)
- func ColorizeDiff(diff []byte) []byte
- func CreateMakefile() (*makex.Makefile, error)
- func GetBuildDataFS(commitID string) (rwvfs.FileSystem, error)
- func Import(buildDataFS vfs.FileSystem, stor interface{}, opt ImportOpt) error
- func InitStoreCmds(c *flags.Command)
- func Main() error
- func PrintJSON(v interface{}, prefix string)
- func SetDefaultCommitIDOpt(c *flags.Command)
- func SetOptionDefaultValue(g *flags.Group, longName string, defaultVal ...string)
- type ConfigCmd
- type CoverageCmd
- type DiffCmd
- type Directory
- type DoAllCmd
- type ImportOpt
- type InfoCmd
- type LintCmd
- type MakeCmd
- type MakefileCmd
- type NormalizeGraphDataCmd
- type Repo
- type SelfUpdateCmd
- type StoreCmd
- type StoreDefsCmd
- type StoreImportCmd
- type StoreIndexCmd
- type StoreIndexesCmd
- type StoreRefsCmd
- type StoreReposCmd
- type StoreUnitsCmd
- type StoreVersionsCmd
- type TestCmd
- type ToolCmd
- type ToolName
- type ToolchainBundleCmd
- type ToolchainCmd
- type ToolchainInstallCmd
- type ToolchainListCmd
- type ToolchainListToolsCmd
- type ToolchainPath
- type ToolchainUnbundleCmd
- type UnitsCmd
Constants ¶
This section is empty.
Variables ¶
var ( // CacheLocalRepo controls whether OpenLocalRepo caches the // results of OpenRepo the first time it runs and returns the same // repo for all subsequent calls (even if you call os.Chdir, for // example). CacheLocalRepo = true )
var GlobalOpt struct { Verbose bool `short:"v" description:"show verbose output"` }
GlobalOpt contains global options.
var OpenStore func() (interface{}, error) = storeCmd.store
OpenStore is called by all of the store subcommands to open the store.
var Version = "dev"
Version of srclib.
For releases, this is set using the -X flag to `go tool ld`. See http://stackoverflow.com/a/11355611.
Functions ¶
func AddCommands ¶
func AddCommands(c *flags.Command)
AddCommands adds all of the "srclib ..." subcommands (toolchain, tool, make, etc.) as subcommands on c.
It is used to create the "srclib" command, but it can also be used to mount the srclib CLI underneath any other CLI tool's command, such as "mytool srclib ...".
func ColorizeDiff ¶
ColorizeDiff takes a byte slice of lines and returns the same, but with diff highlighting. That is, lines starting with '+' are green and lines starting with '-' are red.
func CreateMakefile ¶
CreateMakefile creates a Makefile to build a tree. The cwd should be the root of the tree you want to make (due to some probably unnecessary assumptions that CreateMaker makes).
func GetBuildDataFS ¶
func GetBuildDataFS(commitID string) (rwvfs.FileSystem, error)
func Import ¶
func Import(buildDataFS vfs.FileSystem, stor interface{}, opt ImportOpt) error
Import imports build data into a RepoStore or MultiRepoStore.
func InitStoreCmds ¶
func InitStoreCmds(c *flags.Command)
func SetDefaultCommitIDOpt ¶
func SetDefaultCommitIDOpt(c *flags.Command)
func SetOptionDefaultValue ¶
Types ¶
type ConfigCmd ¶
type ConfigCmd struct { Output struct { Output string `short:"o" long:"output" description:"output format" default:"text" value-name:"text|json"` } `group:"output"` Args struct { Dir Directory `name:"DIR" default:"." description:"root directory of tree to configure"` } `positional-args:"yes"` Quiet bool `short:"q" long:"quiet" description:"silence all output"` // contains filtered or unexported fields }
type CoverageCmd ¶
type CoverageCmd struct { }
func (*CoverageCmd) Execute ¶
func (c *CoverageCmd) Execute(args []string) error
type DiffCmd ¶
type DiffCmd struct { Args struct { ExpFile string `name:"expfile" description:"expected file"` ActFile string `name:"actfile" description:"actual file"` } `positional-args:"yes"` }
TODO(beyang): should have TestCmd use this in checkResults to give more helpful output
type Directory ¶
type Directory string
Directory is flags.Completer that provides directory name completion. Do not convert Directory to a string type manually, always use Directory.String(). Only use Directory for go-flags.Command fields, not for internal functions.
TODO(sqs): this is annoying. it only completes the dir name and doesn't let you keep typing the arg.
type DoAllCmd ¶
type DoAllCmd struct {
Dir Directory `short:"C" long:"directory" description:"change to DIR before doing anything" value-name:"DIR"`
}
type ImportOpt ¶
type ImportOpt struct { DryRun bool `short:"n" long:"dry-run" description:"print what would be done but don't do anything"` NoIndex bool `long:"no-index" description:"don't build indexes (indexes inside a single source unit are always built)"` Repo string `long:"repo" description:"only import for this repo"` Unit string `long:"unit" description:"only import source units with this name"` UnitType string `long:"unit-type" description:"only import source units with this type"` CommitID string `long:"commit" description:"commit ID of commit whose data to import"` Verbose bool }
type LintCmd ¶
type LintCmd struct { Repo string `short:"r" long:"repo" description:"repository URI (defaults to VCS 'srclib' or 'origin' remote URL)"` NoCheckFiles bool `long:"no-check-files" description:"don't check that file/dir fields refer to actual files"` NoCheckResolve bool `long:"no-check-resolve" description:"don't check that internal refs resolve to existing defs"` Args struct { Paths []string `name:"PATH" description:"path to srclib JSON output file, or a directory tree of such"` } `positional-args:"YES"` }
type MakeCmd ¶
type MakeCmd struct { Quiet bool `short:"q" long:"quiet" description:"silence all output"` DryRun bool `short:"n" long:"dry-run" description:"print what would be done and exit"` Parallel int `short:"j" long:"jobs" description:"allow N parallel jobs" value-name:"N" default-mask:"GOMAXPROCS"` Dir Directory `short:"C" long:"directory" description:"change to DIR before doing anything" value-name:"DIR"` Args struct { Goals []string `name:"GOALS..." description:"Makefile targets to build (default: all)"` } `positional-args:"yes"` }
type MakefileCmd ¶
type MakefileCmd struct{}
func (*MakefileCmd) Execute ¶
func (c *MakefileCmd) Execute(args []string) error
type NormalizeGraphDataCmd ¶
type NormalizeGraphDataCmd struct { UnitType string `long:"unit-type" description:"source unit type (e.g., GoPackage)"` Dir string `long:"dir" description:"directory of source unit (SourceUnit.Dir field)"` }
func (*NormalizeGraphDataCmd) Execute ¶
func (c *NormalizeGraphDataCmd) Execute(args []string) error
type Repo ¶
type Repo struct { RootDir string // Root directory containing repository being analyzed VCSType string // VCS type (git or hg) CommitID string // CommitID of current working directory }
func OpenLocalRepo ¶
OpenLocalRepo opens the VCS repository in or above the current directory.
type SelfUpdateCmd ¶
type SelfUpdateCmd struct {
CheckOnly bool `short:"n" long:"check-only" description:"check for update but do not download and install it"`
}
func (*SelfUpdateCmd) Execute ¶
func (c *SelfUpdateCmd) Execute(_ []string) error
type StoreCmd ¶
type StoreCmd struct { Type string `short:"t" long:"type" description:"the (multi-)repo store type to use (RepoStore, MultiRepoStore, etc.)" default:"RepoStore"` Root string `` /* 150-byte string literal not displayed */ Config string `long:"config" description:"(rarely used) JSON-encoded config for extra config, specific to each store type"` }
type StoreDefsCmd ¶
type StoreDefsCmd struct { Repo string `long:"repo"` Path string `long:"path"` UnitType string `long:"unit-type" ` Unit string `long:"unit"` File string `long:"file"` CommitID string `long:"commit"` RepoCommitIDs string `long:"repo-commits" description:"comma-separated list of repo@commitID specifiers"` Query string `long:"query"` Limit int `short:"n" long:"limit" description:"max results to return (0 for all)"` Offset int `long:"offset" description:"results offset (0 to start with first results)"` // If Filter is non-nil, it is applied along with the above // filters. Filter store.DefFilter }
func (*StoreDefsCmd) Execute ¶
func (c *StoreDefsCmd) Execute(args []string) error
type StoreImportCmd ¶
type StoreImportCmd struct { ImportOpt Quiet bool `short:"q" long:"quiet" description:"silence all output"` Sample bool `long:"sample" description:"(sample data) import sample data, not .srclib-cache data"` SampleDefs int `long:"sample-defs" description:"(sample data) number of sample defs to import" default:"100"` SampleRefs int `long:"sample-refs" description:"(sample data) number of sample refs to import" default:"100"` SampleImportOnly bool `long:"sample-import-only" description:"(sample data) only import, don't demonstrate listing data"` }
func (*StoreImportCmd) Execute ¶
func (c *StoreImportCmd) Execute(args []string) error
type StoreIndexCmd ¶
type StoreIndexCmd struct {
// contains filtered or unexported fields
}
func (*StoreIndexCmd) Execute ¶
func (c *StoreIndexCmd) Execute(args []string) error
func (StoreIndexCmd) IndexCriteria ¶
func (c StoreIndexCmd) IndexCriteria() store.IndexCriteria
type StoreIndexesCmd ¶
type StoreIndexesCmd struct {
// contains filtered or unexported fields
}
func (*StoreIndexesCmd) Execute ¶
func (c *StoreIndexesCmd) Execute(args []string) error
func (StoreIndexesCmd) IndexCriteria ¶
func (c StoreIndexesCmd) IndexCriteria() store.IndexCriteria
type StoreRefsCmd ¶
type StoreRefsCmd struct { Repo string `long:"repo"` UnitType string `long:"unit-type" ` Unit string `long:"unit"` File string `long:"file"` CommitID string `long:"commit"` RepoCommitIDs string `long:"repo-commits" description:"comma-separated list of repo@commitID specifiers"` Start uint32 `long:"start"` End uint32 `long:"end"` DefRepo string `long:"def-repo"` DefUnitType string `long:"def-unit-type" ` DefUnit string `long:"def-unit"` DefPath string `long:"def-path"` Broken bool `long:"broken" description:"only show refs that point to nonexistent defs"` Coverage bool `long:"coverage" description:"print a coverage summary (resolved refs, broken refs, total refs)"` Format string `long:"format" description:"output format ('json' or 'none')" default:"json"` Limit int `short:"n" long:"limit" description:"max results to return (0 for all)"` Offset int `long:"offset" description:"results offset (0 to start with first results)"` }
func (*StoreRefsCmd) Execute ¶
func (c *StoreRefsCmd) Execute(args []string) error
type StoreReposCmd ¶
type StoreReposCmd struct {
IDContains string `short:"i" long:"id-contains" description:"filter to repos whose ID contains this substring"`
}
func (*StoreReposCmd) Execute ¶
func (c *StoreReposCmd) Execute(args []string) error
type StoreUnitsCmd ¶
type StoreUnitsCmd struct { Type string `long:"type" ` Name string `long:"name"` CommitID string `long:"commit"` Repo string `long:"repo"` RepoCommitIDs string `long:"repo-commits" description:"comma-separated list of repo@commitID specifiers"` File string `long:"file" description:"filter by units whose Files list contains this file"` }
func (*StoreUnitsCmd) Execute ¶
func (c *StoreUnitsCmd) Execute(args []string) error
type StoreVersionsCmd ¶
type StoreVersionsCmd struct { Repo string `long:"repo"` CommitIDPrefix string `long:"commit" description:"commit ID prefix"` RepoCommitIDs string `long:"repo-commits" description:"comma-separated list of repo@commitID specifiers"` }
func (*StoreVersionsCmd) Execute ¶
func (c *StoreVersionsCmd) Execute(args []string) error
type TestCmd ¶
type ToolCmd ¶
type ToolCmd struct { Args struct { Toolchain ToolchainPath `name:"TOOLCHAIN" description:"toolchain path of the toolchain to run"` Tool ToolName `name:"TOOL" description:"tool subcommand name to run (in TOOLCHAIN)"` ToolArgs []string `name:"ARGS" description:"args to pass to TOOL"` } `positional-args:"yes" required:"yes"` }
type ToolchainBundleCmd ¶
type ToolchainBundleCmd struct { Variant string `long:"variant" description:"only produce a bundle for the given variant (default is all variants)"` DryRun bool `short:"n" long:"dry-run" description:"don't do anything, but print what would be done"` Args struct { Toolchain ToolchainPath `name:"TOOLCHAIN" description:"toolchain to bundle" required:"yes"` Dir string `name:"TOOLCHAIN-DIR" description:"dir containing toolchain files (default: look up TOOLCHAIN in SRCLIBPATH)"` } `positional-args:"yes"` }
func (*ToolchainBundleCmd) Execute ¶
func (c *ToolchainBundleCmd) Execute(args []string) error
type ToolchainCmd ¶
type ToolchainCmd struct{}
func (*ToolchainCmd) Execute ¶
func (c *ToolchainCmd) Execute(args []string) error
type ToolchainInstallCmd ¶
type ToolchainInstallCmd struct { // Args are not required so we can print out a more detailed // error message inside (*ToolchainInstallCmd).Execute. Args struct { Languages []string `value-name:"LANG" description:"language toolchains to install"` } `positional-args:"yes"` }
func (*ToolchainInstallCmd) Execute ¶
func (c *ToolchainInstallCmd) Execute(args []string) error
type ToolchainListCmd ¶
type ToolchainListCmd struct { }
func (*ToolchainListCmd) Execute ¶
func (c *ToolchainListCmd) Execute(args []string) error
type ToolchainListToolsCmd ¶
type ToolchainListToolsCmd struct { Op string `short:"p" long:"op" description:"only list tools that perform these operations only" value-name:"OP"` SourceUnitType string `short:"u" long:"source-unit-type" description:"only list tools that operate on this source unit type" value-name:"TYPE"` Args struct { Toolchains []ToolchainPath `name:"TOOLCHAINS" description:"only list tools in these toolchains"` } `positional-args:"yes" required:"yes"` }
func (*ToolchainListToolsCmd) Execute ¶
func (c *ToolchainListToolsCmd) Execute(args []string) error
type ToolchainPath ¶
type ToolchainPath string
func (ToolchainPath) Complete ¶
func (t ToolchainPath) Complete(match string) []flags.Completion
type ToolchainUnbundleCmd ¶
type ToolchainUnbundleCmd struct { Args struct { Toolchain string `name:"TOOLCHAIN" description:"toolchain path to unbundle to"` BundleFile string `name:"BUNDLE-FILE" description:"bundle file containing toolchain dir contents (.tar.gz, .tar, etc.)"` } `positional-args:"yes" required:"yes"` }
func (*ToolchainUnbundleCmd) Execute ¶
func (c *ToolchainUnbundleCmd) Execute(args []string) error
type UnitsCmd ¶
Source Files ¶
- build_data.go
- cli.go
- cmdutil.go
- config_cmd.go
- coverage_cmd.go
- doall_cmd.go
- gen_data_cmd.go
- info_cmds.go
- internal_data_cmds.go
- lint_cmd.go
- make_cmd.go
- makefile_cmd.go
- misc.go
- repo_cmds.go
- repo_config.go
- repo_opt.go
- selfupdate_cmd.go
- store_cmds.go
- test_cmd.go
- tool_cmd.go
- toolchain_cmd.go
- units_cmd.go
- util.go
- version_cmd.go