Documentation ¶
Index ¶
- Variables
- func CloseAll(files map[string]io.ReadCloser)
- func ColorizeDiff(diff []byte) []byte
- func CreateMakefile(execOpt ToolchainExecOpt) (*makex.Makefile, error)
- func Main() error
- func NewAPIClientWithAuthIfPresent() *sourcegraph.Client
- func OpenInputFiles(extraArgs []string) map[string]io.ReadCloser
- func PrintJSON(v interface{}, prefix string)
- func SetOptionDefaultValue(g *flags.Group, longName string, defaultVal ...string)
- func SourceUnitMatchesArgs(specified []string, u *unit.SourceUnit) bool
- type APICmd
- type APIDepsCmd
- type APIDescribeCmd
- type APIListCmd
- type APIUnitsCmd
- type BuildCacheOpt
- type BuildCmd
- type BuildDataCatCmd
- type BuildDataCmd
- type BuildDataFetchCmd
- type BuildDataListCmd
- type BuildDataRemoveCmd
- type BuildDataUploadCmd
- type BuildsCmd
- type ConfigCmd
- type DiffCmd
- type Directory
- type DoAllCmd
- type InfoCmd
- type LintCmd
- type LoginCmd
- type MakeCmd
- type MakefileCmd
- type NormalizeGraphDataCmd
- type PushCmd
- type QueryCmd
- type RemoteAddCmd
- type RemoteCmd
- type RemoteImportBuildCmd
- type Repo
- type RepoCmd
- type SelfupdateCmd
- type TestCmd
- type ToolCmd
- type ToolName
- type ToolchainAddCmd
- type ToolchainBuildCmd
- type ToolchainCmd
- type ToolchainExecOpt
- type ToolchainGetCmd
- type ToolchainInstallStdCmd
- type ToolchainListCmd
- type ToolchainListToolsCmd
- type ToolchainPath
- type UnitsCmd
- type VersionCmd
Constants ¶
This section is empty.
Variables ¶
var CLI = flags.NewNamedParser("src", flags.Default)
var GlobalOpt struct { Verbose bool `short:"v" description:"show verbose output"` }
GlobalOpt contains global options.
var Version string
Version of src.
For releases, this is set using the -X flag to `go tool ld`. See http://stackoverflow.com/a/11355611.
Functions ¶
func CloseAll ¶
func CloseAll(files map[string]io.ReadCloser)
func ColorizeDiff ¶ added in v0.0.29
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 ¶ added in v0.0.27
func CreateMakefile(execOpt ToolchainExecOpt) (*makex.Makefile, error)
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 NewAPIClientWithAuthIfPresent ¶ added in v0.0.27
func NewAPIClientWithAuthIfPresent() *sourcegraph.Client
NewAPIClientWithAuthIfPresent calls newAPIClient with the user auth credentials from the userAuthFile (if present), and otherwise creates an unauthed API client.
func OpenInputFiles ¶
func OpenInputFiles(extraArgs []string) map[string]io.ReadCloser
func SetOptionDefaultValue ¶
func SourceUnitMatchesArgs ¶
func SourceUnitMatchesArgs(specified []string, u *unit.SourceUnit) bool
Types ¶
type APIDepsCmd ¶ added in v0.0.27
type APIDepsCmd struct { Args struct { Dir Directory `name:"DIR" default:"." description:"root directory of target project"` } `positional-args:"yes"` }
func (*APIDepsCmd) Execute ¶ added in v0.0.27
func (c *APIDepsCmd) Execute(args []string) error
type APIDescribeCmd ¶
type APIDescribeCmd struct { File string `long:"file" required:"yes" value-name:"FILE"` StartByte int `long:"start-byte" required:"yes" value-name:"BYTE"` NoExamples bool `long:"no-examples" describe:"don't show examples from Sourcegraph.com"` }
func (*APIDescribeCmd) Execute ¶
func (c *APIDescribeCmd) Execute(args []string) error
type APIListCmd ¶ added in v0.0.16
type APIListCmd struct {
File string `long:"file" required:"yes" value-name:"FILE"`
}
func (*APIListCmd) Execute ¶ added in v0.0.16
func (c *APIListCmd) Execute(args []string) error
type APIUnitsCmd ¶ added in v0.0.27
type APIUnitsCmd struct { Args struct { Dir Directory `name:"DIR" default:"." description:"root directory of target project"` } `positional-args:"yes"` }
func (*APIUnitsCmd) Execute ¶ added in v0.0.27
func (c *APIUnitsCmd) Execute(args []string) error
type BuildCacheOpt ¶
type BuildCmd ¶ added in v0.0.30
type BuildDataCatCmd ¶ added in v0.0.27
type BuildDataCatCmd struct { Args struct { File string `name:"FILE" default:"." description:"file whose contents to print"` } `positional-args:"yes"` // contains filtered or unexported fields }
func (*BuildDataCatCmd) Execute ¶ added in v0.0.27
func (c *BuildDataCatCmd) Execute(args []string) error
type BuildDataCmd ¶ added in v0.0.27
type BuildDataCmd struct { }
func (*BuildDataCmd) Execute ¶ added in v0.0.27
func (c *BuildDataCmd) Execute(args []string) error
type BuildDataFetchCmd ¶ added in v0.0.27
type BuildDataFetchCmd struct { DryRun bool `short:"n" long:"dry-run" description:"don't do anything, just show what would be done"` // contains filtered or unexported fields }
func (*BuildDataFetchCmd) Execute ¶ added in v0.0.27
func (c *BuildDataFetchCmd) Execute(args []string) error
type BuildDataListCmd ¶ added in v0.0.27
type BuildDataListCmd struct { Args struct { Dir string `name:"DIR" default:"." description:"list build data files in this dir"` } `positional-args:"yes"` Recursive bool `short:"r" long:"recursive" description:"list recursively"` Long bool `short:"l" long:"long" description:"show file sizes and times"` Type string `long:"type" description:"show only entries of this type (f=file, d=dir)"` URLs bool `long:"urls" description:"show URLs to build data files (implies -l)"` // contains filtered or unexported fields }
func (*BuildDataListCmd) Execute ¶ added in v0.0.27
func (c *BuildDataListCmd) Execute(args []string) error
type BuildDataRemoveCmd ¶ added in v0.0.27
type BuildDataRemoveCmd struct { Recursive bool `short:"r" description:"recursively delete files and dir"` Args struct { Files []string `name:"FILES" default:"." description:"file to remove"` } `positional-args:"yes"` // contains filtered or unexported fields }
func (*BuildDataRemoveCmd) Execute ¶ added in v0.0.27
func (c *BuildDataRemoveCmd) Execute(args []string) error
type BuildDataUploadCmd ¶ added in v0.0.27
type BuildDataUploadCmd struct { DryRun bool `short:"n" long:"dry-run" description:"don't do anything, just show what would be done"` // contains filtered or unexported fields }
func (*BuildDataUploadCmd) Execute ¶ added in v0.0.27
func (c *BuildDataUploadCmd) Execute(args []string) error
type BuildsCmd ¶ added in v0.0.30
type BuildsCmd struct { N int `short:"n" description:"number of builds to show" default:"5"` Rev string `long:"rev" description:"filter builds by revision or commit ID"` Queued bool `long:"queued"` Succeeded bool `long:"succeeded"` Ended bool `long:"ended"` Failed bool `long:"failed"` Sort string `long:"sort" default:"updated_at"` Direction string `long:"dir" default:"desc"` }
type ConfigCmd ¶
type ConfigCmd struct { config.Options ToolchainExecOpt `group:"execution"` BuildCacheOpt `group:"build cache"` 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"` // contains filtered or unexported fields }
type DiffCmd ¶ added in v0.0.27
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.
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 { config.Options ToolchainExecOpt `group:"execution"` BuildCacheOpt `group:"build cache"` Dir Directory `short:"C" long:"directory" description:"change to DIR before doing anything" value-name:"DIR"` }
type LintCmd ¶ added in v0.0.31
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 LoginCmd ¶ added in v0.0.27
type MakeCmd ¶
type MakeCmd struct { config.Options ToolchainExecOpt `group:"execution"` BuildCacheOpt `group:"build cache"` DryRun bool `short:"n" long:"dry-run" description:"print what would be done and exit"` 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 ¶ added in v0.0.27
type MakefileCmd struct {
ToolchainExecOpt `group:"execution"`
}
func (*MakefileCmd) Execute ¶ added in v0.0.27
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 RemoteAddCmd ¶ added in v0.0.30
type RemoteAddCmd struct { VCSType string `long:"vcs" description:"VCS type" required:"yes"` CloneURL string `long:"clone-url" description:"clone URL" required:"yes"` }
func (*RemoteAddCmd) Execute ¶ added in v0.0.30
func (c *RemoteAddCmd) Execute(args []string) error
type RemoteCmd ¶ added in v0.0.27
type RemoteCmd struct {
RepoURI string `short:"r" long:"repo" description:"repository URI (defaults to VCS 'srclib' or 'origin' remote URL)"`
}
type RemoteImportBuildCmd ¶ added in v0.0.30
type RemoteImportBuildCmd struct {
CommitID string `short:"c" long:"commit" description:"commit ID of data to import" required:"yes"`
}
func (*RemoteImportBuildCmd) Execute ¶ added in v0.0.30
func (c *RemoteImportBuildCmd) 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 CloneURL string // CloneURL of repo. }
func (*Repo) RepoRevSpec ¶ added in v0.0.27
func (r *Repo) RepoRevSpec() sourcegraph.RepoRevSpec
type SelfupdateCmd ¶ added in v0.0.16
type SelfupdateCmd struct { }
func (*SelfupdateCmd) Execute ¶ added in v0.0.16
func (c *SelfupdateCmd) Execute(args []string) error
type TestCmd ¶
type TestCmd struct { GenerateExpected bool `long:"gen" description:"(re)generate expected output for all test cases and exit"` ToolchainExecOpt Args struct { Trees []Directory `name:"TREES" description:"trees to treat as test cases"` } `positional-args:"yes"` }
type ToolCmd ¶
type ToolCmd struct { ToolchainExecOpt 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 ToolchainAddCmd ¶ added in v0.0.3
type ToolchainAddCmd struct { Dir string `long:"dir" description:"directory containing toolchain to add" value-name:"DIR"` Args struct { ToolchainPath string `name:"TOOLCHAIN" default:"." description:"toolchain path to use for toolchain directory"` } `positional-args:"yes" required:"yes"` }
func (*ToolchainAddCmd) Execute ¶ added in v0.0.3
func (c *ToolchainAddCmd) Execute(args []string) error
type ToolchainBuildCmd ¶
type ToolchainBuildCmd struct { Args struct { Toolchains []ToolchainPath `name:"TOOLCHAINS" description:"toolchain paths of toolchains to build"` } `positional-args:"yes" required:"yes"` }
func (*ToolchainBuildCmd) Execute ¶
func (c *ToolchainBuildCmd) Execute(args []string) error
type ToolchainCmd ¶
type ToolchainCmd struct{}
func (*ToolchainCmd) Execute ¶
func (c *ToolchainCmd) Execute(args []string) error
type ToolchainExecOpt ¶
type ToolchainExecOpt struct {
ExeMethods string `short:"m" long:"methods" default:"program,docker" description:"toolchain execution methods" value-name:"METHODS"`
}
func (*ToolchainExecOpt) ToolchainMode ¶
func (o *ToolchainExecOpt) ToolchainMode() toolchain.Mode
type ToolchainGetCmd ¶
type ToolchainGetCmd struct { Update bool `short:"u" long:"update" description:"use the network to update the toolchain"` Args struct { Toolchains []ToolchainPath `name:"TOOLCHAINS" description:"toolchain paths of toolchains to get"` } `positional-args:"yes" required:"yes"` }
func (*ToolchainGetCmd) Execute ¶
func (c *ToolchainGetCmd) Execute(args []string) error
type ToolchainInstallStdCmd ¶ added in v0.0.17
type ToolchainInstallStdCmd struct {
Skip []string `` /* 142-byte string literal not displayed */
}
func (*ToolchainInstallStdCmd) Execute ¶ added in v0.0.17
func (c *ToolchainInstallStdCmd) 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 UnitsCmd ¶
type UnitsCmd struct { config.Options ToolchainExecOpt `group:"execution"` 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 list units in"` } `positional-args:"yes"` }
type VersionCmd ¶ added in v0.0.16
type VersionCmd struct {
NoCheck bool `long:"no-check-update" description:"don't check for updates"`
}
func (*VersionCmd) Execute ¶ added in v0.0.16
func (c *VersionCmd) Execute(args []string) error
Source Files ¶
- api_cmds.go
- auth_cmds.go
- build_cmd.go
- build_data_cmds.go
- cache_opt.go
- cli.go
- cmdutil.go
- config_cmd.go
- doall_cmd.go
- info_cmds.go
- internal_data_cmds.go
- lint_cmd.go
- make_cmd.go
- makefile_cmd.go
- misc.go
- pull_cmd.go
- push_cmd.go
- query_cmd.go
- remote_builds_cmd.go
- remote_cmds.go
- remote_helpers.go
- remote_import_build_data_cmd.go
- remote_repo_cmds.go
- repo_cmds.go
- repo_config.go
- repo_opt.go
- selfupdate_cmd.go
- term_util.go
- test_cmd.go
- tool_cmd.go
- toolchain_cmd.go
- units_cmd.go
- util.go
- version_cmd.go