Skip to content

Commit fcea1d5

Browse files
authored
Add indexer name option to lsif upload command. (#123)
1 parent 21dd58b commit fcea1d5

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

cmd/src/lsif_upload.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,21 @@ func init() {
2424
usage := `
2525
Examples:
2626
27-
Upload an LSIF dump:
27+
Upload an LSIF dump with explicit repo, commit, and upload files:
2828
2929
$ src lsif upload -repo=FOO -commit=BAR -file=dump.lsif
3030
3131
Upload an LSIF dump for a subproject:
3232
33-
$ src lsif upload -repo=FOO -commit=BAR -file=dump.lsif -root=cmd/
33+
$ src lsif upload -root=cmd/
3434
3535
Upload an LSIF dump when lsifEnforceAuth is enabled:
3636
37-
$ src lsif upload -repo=FOO -commit=BAR -file=dump.lsif -github-token=BAZ
37+
$ src lsif upload -github-token=BAZ
38+
39+
Upload an LSIF dump when the LSIF indexer does not not declare a tool name.
40+
41+
$ src lsif upload -indexerName=lsif-elixir
3842
`
3943

4044
flagSet := flag.NewFlagSet("upload", flag.ExitOnError)
@@ -49,6 +53,7 @@ Examples:
4953
fileFlag = flagSet.String("file", "./dump.lsif", `The path to the LSIF dump file.`)
5054
githubTokenFlag = flagSet.String("github-token", "", `A GitHub access token with 'public_repo' scope that Sourcegraph uses to verify you have access to the repository.`)
5155
rootFlag = flagSet.String("root", "", `The path in the repository that matches the LSIF projectRoot (e.g. cmd/project1). Defaults to the empty string, which refers to the top level of the repository.`)
56+
indexerName = flagSet.String("indexerName", "", `The name of the indexer that generated the dump. This will override the 'toolInfo.name' field in the metadata vertex of the LSIF dump file. This must be supplied if the indexer does not set this field (in which case the upload will fail with an explicit message).`)
5257
apiFlags = newAPIFlags(flagSet)
5358
)
5459

@@ -137,6 +142,9 @@ Examples:
137142
if *rootFlag != "" {
138143
qs.Add("root", *rootFlag)
139144
}
145+
if *indexerName != "" {
146+
qs.Add("indexerName", *indexerName)
147+
}
140148

141149
url, err := url.Parse(cfg.Endpoint + "/.api/lsif/upload")
142150
if err != nil {

0 commit comments

Comments
 (0)