Skip to content

Commit 25125fb

Browse files
trlyMaedahBatool
andauthored
Docs/src cli search jobs (#1036)
Add documentation for src search-jobs feature sourcegraph/src-cli#1145 ## Pull Request approval You will need to get your PR approved by at least one member of the Sourcegraph team. For reviews of docs formatting, styles, and component usage, please tag the docs team via the #docs Slack channel. --------- Co-authored-by: Maedah Batool <[email protected]>
1 parent c527318 commit 25125fb

File tree

10 files changed

+363
-0
lines changed

10 files changed

+363
-0
lines changed

docs/cli/references/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Most commands require that the user first [authenticate](quickstart#connect-to-s
1818
* [`repos`](references/repos)
1919
* [`scout`](references/scout)
2020
* [`search`](references/search)
21+
* [`search-jobs`](references/search-jobs)
2122
* [`serve-git`](references/serve-git)
2223
* [`snapshot`](references/snapshot)
2324
* [`teams`](references/teams)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# src search-jobs
2+
3+
<p className="subtitle">`src search-jobs` is a tool that manages search jobs in a Sourcegraph instance.</p>
4+
5+
## Usage
6+
7+
```bash
8+
'src search-jobs' is a tool that manages search jobs on a Sourcegraph instance.
9+
10+
Usage:
11+
12+
src search-jobs command [command options]
13+
14+
The commands are:
15+
16+
cancel cancels a search job by ID
17+
create creates a search job
18+
delete deletes a search job by ID
19+
get gets a search job by ID
20+
list lists search jobs
21+
logs fetches logs for a search job by ID
22+
restart restarts a search job by ID
23+
results fetches results for a search job by ID
24+
25+
Common options for all commands:
26+
-c Select columns to display (e.g., -c id,query,state,username)
27+
-json Output results in JSON format
28+
29+
Use "src search-jobs [command] -h" for more information about a command.
30+
```
31+
32+
## Sub-commands
33+
34+
* [cancel](search-jobs/cancel)
35+
* [create](search-jobs/create)
36+
* [delete](search-jobs/delete)
37+
* [get](search-jobs/get)
38+
* [list](search-jobs/list)
39+
* [logs](search-jobs/logs)
40+
* [restart](search-jobs/restart)
41+
* [results](search-jobs/results)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# src search-jobs cancel
2+
3+
<p className="subtitle">`src search-jobs cancel` is a tool that cancels a search job on a Sourcegraph instance.</p>
4+
5+
## Usage
6+
7+
```bash
8+
Usage of 'src search-jobs cancel':
9+
-c string
10+
Comma-separated list of columns to display. Available: id,query,state,username,createdat,startedat,finishedat,url,logurl,total,completed,failed,inprogress (default "id,username,state,query")
11+
-dump-requests
12+
Log GraphQL requests and responses to stdout
13+
-get-curl
14+
Print the curl command for executing this query and exit (WARNING: includes printing your access token!)
15+
-insecure-skip-verify
16+
Skip validation of TLS certificates against trusted chains
17+
-json
18+
Output results as JSON for programmatic access
19+
-trace
20+
Log the trace ID for requests. See https://docs.sourcegraph.com/admin/observability/tracing
21+
-user-agent-telemetry
22+
Include the operating system and architecture in the User-Agent sent with requests to Sourcegraph (default true)
23+
24+
Examples:
25+
26+
Cancel a search job by ID:
27+
28+
$ src search-jobs cancel U2VhcmNoSm9iOjY5
29+
30+
Arguments:
31+
The ID of the search job to cancel.
32+
33+
The cancel command stops a running search job and outputs a confirmation message.
34+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# src search-jobs create
2+
3+
<p className="subtitle">`src search-jobs create` is a tool that creates a search job on a Sourcegraph instance.</p>
4+
5+
## Usage
6+
7+
```bash
8+
Usage of 'src search-jobs create':
9+
-c string
10+
Comma-separated list of columns to display. Available: id,query,state,username,createdat,startedat,finishedat,url,logurl,total,completed,failed,inprogress (default "id,username,state,query")
11+
-dump-requests
12+
Log GraphQL requests and responses to stdout
13+
-get-curl
14+
Print the curl command for executing this query and exit (WARNING: includes printing your access token!)
15+
-insecure-skip-verify
16+
Skip validation of TLS certificates against trusted chains
17+
-json
18+
Output results as JSON for programmatic access
19+
-trace
20+
Log the trace ID for requests. See https://docs.sourcegraph.com/admin/observability/tracing
21+
-user-agent-telemetry
22+
Include the operating system and architecture in the User-Agent sent with requests to Sourcegraph (default true)
23+
24+
Examples:
25+
26+
Create a search job:
27+
28+
$ src search-jobs create "repo:^github\.com/sourcegraph/sourcegraph$ sort:indexed-desc"
29+
30+
Create a search job and display specific columns:
31+
32+
$ src search-jobs create "repo:sourcegraph" -c id,state,username
33+
34+
Create a search job and output in JSON format:
35+
36+
$ src search-jobs create "repo:sourcegraph" -json
37+
38+
Available columns are: id, query, state, username, createdat, startedat, finishedat,
39+
url, logurl, total, completed, failed, inprogress
40+
```
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# src search-jobs delete
2+
3+
<p className="subtitle">`src search-jobs delete` is a tool that deletes a search job on a Sourcegraph instance.</p>
4+
5+
```bash
6+
Usage of 'src search-jobs delete':
7+
-c string
8+
Comma-separated list of columns to display. Available: id,query,state,username,createdat,startedat,finishedat,url,logurl,total,completed,failed,inprogress (default "id,username,state,query")
9+
-dump-requests
10+
Log GraphQL requests and responses to stdout
11+
-get-curl
12+
Print the curl command for executing this query and exit (WARNING: includes printing your access token!)
13+
-insecure-skip-verify
14+
Skip validation of TLS certificates against trusted chains
15+
-json
16+
Output results as JSON for programmatic access
17+
-trace
18+
Log the trace ID for requests. See https://docs.sourcegraph.com/admin/observability/tracing
19+
-user-agent-telemetry
20+
Include the operating system and architecture in the User-Agent sent with requests to Sourcegraph (default true)
21+
22+
Examples:
23+
24+
Delete a search job by ID:
25+
26+
$ src search-jobs delete U2VhcmNoSm9iOjY5
27+
28+
Arguments:
29+
The ID of the search job to delete.
30+
31+
The delete command permanently removes a search job and outputs a confirmation message.
32+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# src search-jobs get
2+
3+
<p className="subtitle">`src search-jobs get` is a tool that gets details of a single search job on a Sourcegraph instance.</p>
4+
5+
## Usage
6+
7+
```bash
8+
Usage of 'src search-jobs get':
9+
-c string
10+
Comma-separated list of columns to display. Available: id,query,state,username,createdat,startedat,finishedat,url,logurl,total,completed,failed,inprogress (default "id,username,state,query")
11+
-dump-requests
12+
Log GraphQL requests and responses to stdout
13+
-get-curl
14+
Print the curl command for executing this query and exit (WARNING: includes printing your access token!)
15+
-insecure-skip-verify
16+
Skip validation of TLS certificates against trusted chains
17+
-json
18+
Output results as JSON for programmatic access
19+
-trace
20+
Log the trace ID for requests. See https://docs.sourcegraph.com/admin/observability/tracing
21+
-user-agent-telemetry
22+
Include the operating system and architecture in the User-Agent sent with requests to Sourcegraph (default true)
23+
24+
Examples:
25+
26+
Get a search job by ID:
27+
28+
$ src search-jobs get U2VhcmNoSm9iOjY5
29+
30+
Get a search job with specific columns:
31+
32+
$ src search-jobs get U2VhcmNoSm9iOjY5 -c id,state,username
33+
34+
Get a search job in JSON format:
35+
36+
$ src search-jobs get U2VhcmNoSm9iOjY5 -json
37+
38+
Available columns are: id, query, state, username, createdat, startedat, finishedat,
39+
url, logurl, total, completed, failed, inprogress
40+
```
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# src search-jobs list
2+
3+
<p className="subtitle">`src search-jobs list` is a tool that lists search jobs on a Sourcegraph instance.</p>
4+
5+
## Usage
6+
7+
```bash
8+
Usage of 'src search-jobs list':
9+
-asc
10+
Sort search jobs in ascending order
11+
-c string
12+
Comma-separated list of columns to display. Available: id,query,state,username,createdat,startedat,finishedat,url,logurl,total,completed,failed,inprogress (default "id,username,state,query")
13+
-dump-requests
14+
Log GraphQL requests and responses to stdout
15+
-get-curl
16+
Print the curl command for executing this query and exit (WARNING: includes printing your access token!)
17+
-insecure-skip-verify
18+
Skip validation of TLS certificates against trusted chains
19+
-json
20+
Output results as JSON for programmatic access
21+
-limit int
22+
Limit the number of search jobs returned (default 10)
23+
-order-by string
24+
Sort search jobs by a sortable field (QUERY, CREATED_AT, STATE) (default "CREATED_AT")
25+
-trace
26+
Log the trace ID for requests. See https://docs.sourcegraph.com/admin/observability/tracing
27+
-user-agent-telemetry
28+
Include the operating system and architecture in the User-Agent sent with requests to Sourcegraph (default true)
29+
30+
Examples:
31+
32+
List all search jobs:
33+
34+
$ src search-jobs list
35+
36+
List all search jobs in ascending order:
37+
38+
$ src search-jobs list --asc
39+
40+
Limit the number of search jobs returned:
41+
42+
$ src search-jobs list --limit 5
43+
44+
Order search jobs by a field (must be one of: QUERY, CREATED_AT, STATE):
45+
46+
$ src search-jobs list --order-by QUERY
47+
48+
Select specific columns to display:
49+
50+
$ src search-jobs list -c id,state,username,createdat
51+
52+
Output results as JSON:
53+
54+
$ src search-jobs list -json
55+
56+
Combine options:
57+
58+
$ src search-jobs list --limit 10 --order-by STATE --asc -c id,query,state
59+
60+
Available columns are: id, query, state, username, createdat, startedat, finishedat,
61+
url, logurl, total, completed, failed, inprogress
62+
```
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# src search-jobs logs
2+
3+
<p className="subtitle">`src search-jobs logs` is a tool that gets the logs of a search job on a Sourcegraph instance.</p>
4+
5+
## Usage
6+
7+
```bash
8+
Usage of 'src search-jobs logs':
9+
-c string
10+
Comma-separated list of columns to display. Available: id,query,state,username,createdat,startedat,finishedat,url,logurl,total,completed,failed,inprogress (default "id,username,state,query")
11+
-dump-requests
12+
Log GraphQL requests and responses to stdout
13+
-get-curl
14+
Print the curl command for executing this query and exit (WARNING: includes printing your access token!)
15+
-insecure-skip-verify
16+
Skip validation of TLS certificates against trusted chains
17+
-json
18+
Output results as JSON for programmatic access
19+
-out string
20+
File path to save the logs (optional)
21+
-trace
22+
Log the trace ID for requests. See https://docs.sourcegraph.com/admin/observability/tracing
23+
-user-agent-telemetry
24+
Include the operating system and architecture in the User-Agent sent with requests to Sourcegraph (default true)
25+
26+
Examples:
27+
28+
View the logs of a search job:
29+
$ src search-jobs logs U2VhcmNoSm9iOjY5
30+
31+
Save the logs to a file:
32+
$ src search-jobs logs U2VhcmNoSm9iOjY5 -out logs.csv
33+
34+
The logs command retrieves the raw log data in CSV format. The data will be
35+
displayed on stdout or written to the file specified with -out.
36+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# src search-jobs restart
2+
3+
<p className="subtitle">`src search-jobs restart` is a tool that restarts a search job on a Sourcegraph instance.</p>
4+
5+
## Usage
6+
7+
```bash
8+
Usage of 'src search-jobs restart':
9+
-c string
10+
Comma-separated list of columns to display. Available: id,query,state,username,createdat,startedat,finishedat,url,logurl,total,completed,failed,inprogress (default "id,username,state,query")
11+
-dump-requests
12+
Log GraphQL requests and responses to stdout
13+
-get-curl
14+
Print the curl command for executing this query and exit (WARNING: includes printing your access token!)
15+
-insecure-skip-verify
16+
Skip validation of TLS certificates against trusted chains
17+
-json
18+
Output results as JSON for programmatic access
19+
-trace
20+
Log the trace ID for requests. See https://docs.sourcegraph.com/admin/observability/tracing
21+
-user-agent-telemetry
22+
Include the operating system and architecture in the User-Agent sent with requests to Sourcegraph (default true)
23+
24+
Examples:
25+
26+
Restart a search job by ID:
27+
28+
$ src search-jobs restart U2VhcmNoSm9iOjY5
29+
30+
Restart a search job and display specific columns:
31+
32+
$ src search-jobs restart U2VhcmNoSm9iOjY5 -c id,state,query
33+
34+
Restart a search job and output in JSON format:
35+
36+
$ src search-jobs restart U2VhcmNoSm9iOjY5 -json
37+
38+
Available columns are: id, query, state, username, createdat, startedat, finishedat,
39+
url, logurl, total, completed, failed, inprogress
40+
```
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# src search-jobs results
2+
3+
<p className="subtitle">`src search-jobs results` is a tool that gets the results of a search job on a Sourcegraph instance.</p>
4+
5+
## Usage
6+
7+
```bash
8+
Usage of 'src search-jobs results':
9+
-c string
10+
Comma-separated list of columns to display. Available: id,query,state,username,createdat,startedat,finishedat,url,logurl,total,completed,failed,inprogress (default "id,username,state,query")
11+
-dump-requests
12+
Log GraphQL requests and responses to stdout
13+
-get-curl
14+
Print the curl command for executing this query and exit (WARNING: includes printing your access token!)
15+
-insecure-skip-verify
16+
Skip validation of TLS certificates against trusted chains
17+
-json
18+
Output results as JSON for programmatic access
19+
-out string
20+
File path to save the results (optional)
21+
-trace
22+
Log the trace ID for requests. See https://docs.sourcegraph.com/admin/observability/tracing
23+
-user-agent-telemetry
24+
Include the operating system and architecture in the User-Agent sent with requests to Sourcegraph (default true)
25+
26+
Examples:
27+
28+
Get the results of a search job:
29+
$ src search-jobs results U2VhcmNoSm9iOjY5
30+
31+
Save search results to a file:
32+
$ src search-jobs results U2VhcmNoSm9iOjY5 -out results.jsonl
33+
34+
The results command retrieves the raw search results in JSON Lines format.
35+
Each line contains a single JSON object representing a search result. The data
36+
will be displayed on stdout or written to the file specified with -out.
37+
```

0 commit comments

Comments
 (0)