id = "src" name = "Sourcegraph CLI" homepage = "https://github.com/sourcegraph/src-cli" description = "src is a command line interface to Sourcegraph: code search, GraphQL API requests and batch changes from the terminal." # Sourcegraph's mark: the CLI carries no separate logo. icon = "theSVG:sourcegraph" executables = ["src"] [dotfiles] # src-cli, cmd/src/main.go, readConfig(): # if !userSpecified { cfgFile = "~/src-config.json" } # No leading dot, and expandHomeDir() in the same file accepts the Windows # spelling "%USERPROFILE%\src-config.json", which resolves to the same path. paths = ["~/src-config.json"] exclude = [] # Not a whole-file secret: `endpoint` and `proxy` are the settings that make # the CLI point at your instance, and they are worth carrying. The token is # lifted out below. secret = [] # Read once per command; src exits when the command finishes. side_effect = false # configFromFile in cmd/src/main.go is # { endpoint, accessToken, additionalHeaders map[string]string, proxy } # additionalHeaders is where an auth-proxy deployment puts its credential — # main.go refuses to run when it carries an `Authorization` header *and* # SRC_ACCESS_TOKEN is set, because both are the same kind of secret. Header # names are deployment-specific, so every value under it is treated as one. [[dotfiles.secret_paths]] file = "~/src-config.json" match = { key_path = ["accessToken", "additionalHeaders.*"] } [commands] format = 1 label = "Sourcegraph CLI" description = "Run a Sourcegraph code search from the terminal. Other src commands and credentials are left out." quality = "ai-draft" base = "fig:src" parser = { end_of_options = "--", interleave = "permute", long_equals = false, short_attached = true, short_bundles = false } [[commands.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/src.ts" license = "MIT" [[commands.subcommand]] path = ["search"] label = "Code search" description = "Run a search query against the configured Sourcegraph instance." [[commands.subcommand.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/src.ts" license = "MIT" [[commands.subcommand.field]] id = "query" label = "Query" type = "string" position = 0 description = "The search query." sources = ["fig"] [[commands.subcommand.field]] id = "json" label = "JSON output" type = "boolean" option = ["-json"] description = "Output results as JSON." sources = ["fig"] [[commands.subcommand.field]] id = "stream" label = "Stream results" type = "boolean" option = ["-stream"] description = "Consume results as a stream." sources = ["fig"] [[commands.subcommand.field]] id = "less" label = "Pipe to less" type = "boolean" option = ["-less"] description = "Pipe output to less -R when on a terminal." sources = ["fig"] [[commands.subcommand.field]] id = "trace" label = "Log trace ID" type = "boolean" option = ["-trace"] description = "Log the trace ID for requests." sources = ["fig"] [[commands.subcommand.field]] id = "explain_json" label = "Explain JSON schema" type = "boolean" option = ["-explain-json"] description = "Explain the JSON output schema and exit." sources = ["fig"] [[commands.subcommand.task]] id = "search" label = "Search" fields = ["query", "json", "stream"] required = ["query"] [[commands.subcommand.group]] id = "basic" label = "Basic" fields = ["query", "json", "stream", "less"] [[commands.subcommand.group]] id = "advanced" label = "Advanced" fields = ["trace", "explain_json"]