Skip to content

Conversation

@peterguy
Copy link
Contributor

@peterguy peterguy commented Mar 5, 2025

What started as a simple linter placating ended up with adding support for numeric search job ids instead of needing to use the base64-encoded values.

Not sure how helpful that is.

Test plan

TBD

@peterguy peterguy self-assigned this Mar 5, 2025
@peterguy peterguy requested a review from trly March 5, 2025 01:05
@peterguy peterguy marked this pull request as ready for review March 5, 2025 01:11
Copy link
Contributor

@trly trly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the non-encoded ids is a great change. I'll be sure to apply this pattern to future changes I make as well

@trly trly merged commit 52ec689 into feat/search_jobs Mar 5, 2025
8 of 9 checks passed
@trly trly deleted the peterguy/build-on-search_jobs branch March 5, 2025 21:04
trly added a commit that referenced this pull request May 5, 2025
* feat: Add search-jobs CLI commands for managing search jobs

Add new `src search-jobs` command with subcommands to manage search jobs:
- create: Create new search jobs with query validation
- get: Retrieve search job details by ID
- list: List search jobs with sorting and pagination
- cancel: Cancel running search jobs
- delete: Remove search jobs

The command provides functionality to:
- Format output using Go templates
- Sort and filter search jobs
- Track job status

* feat: implement search-jobs logs command

search_jobs_logs:
Implement a new search-jobs subcommand to retrieve jobs logs from the configured Sourcegraph instance.

search_jobs_get.go:
Extract the GraphQL query logic for fetching a search job into a separate helper function to improve code organization and reusability. This change:

- Creates new getSearchJob helper function that encapsulates the GraphQL query logic
- Simplifies the main handler function by delegating job fetching
- Maintains existing functionality while improving code structure

* feat: Add search jobs results retrieval command

Add new command to retrieve search job results in JSONL format with the following capabilities:
- Fetch results using search job ID
- Optional file output with -out flag

* cleanup trailing whitespace

* remove tests as they are not functionally testing production code

* Fix linter issues. Add support for job id numbers (#1151)

* feat: Add search jobs restart command

This commit introduces the `search-jobs restart` command, enabling users to restart a search job by its ID. The command retrieves the query from the original job and creates a new search job with the same query.

* (lint) removed unused testutil

* refactor: Redesign search-jobs command structure with builder pattern

This commit refactors the search-jobs commands to:
- Implement a builder pattern for consistent command creation
- Add column-based output format with customizable columns
- Support JSON output format for programmatic access
- Improve argument handling by using positional arguments for IDs
- Separate command logic from presentation for better testability
- Extract common functionality into reusable helper functions
- Enhance usage documentation with better examples
- Remove SearchJobID parsing functions in favor of direct ID handling

* refactor:  make search-jobs command builder methods private

* (fix) do not display command success output when using -get-curl

* (fix) clean up inconsistencies in usage text

---------

Co-authored-by: Peter Guy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants