Skip to content

feat: replace import flags with --query for GitHub search syntax#29

Merged
stefreak merged 7 commits intomainfrom
copilot/add-query-option-for-import
Dec 1, 2025
Merged

feat: replace import flags with --query for GitHub search syntax#29
stefreak merged 7 commits intomainfrom
copilot/add-query-option-for-import

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 1, 2025

Replaces --user, --org, --repo, and all filter flags (--skip-*, --include-*) with a single --query option that accepts GitHub search syntax.

Changes

  • Import command: Added --query/-q option using octocrab's SearchHandler
  • Removed flags: --user, --org, --repo, --skip-forks, --skip-private, --skip-internal, --skip-public, --include-archived
  • Validation: --query and positional repository arguments are mutually exclusive with clear error messages
  • Removed code: RepoFilters struct and should_skip_repo function no longer needed

Usage

# Query-based import
nut import -q "owner:stefreak language:rust -fork:true"
nut import -q "org:actions language:JavaScript,TypeScript -archived:true"

# Positional args still supported
nut import owner/repo1 owner/repo2

# Mutual exclusivity enforced
nut import -q "language:rust" owner/repo  # Error: use one or the other

Query syntax matches github.com/search.

Documentation

Updated README.md with query examples and removed references to deprecated flags.

Original prompt

Create a new option --query or -q allowing users to import all repositories matching a certain pattern.
Remove the options --user, --org, --repo, --skip-* and --include-* in favor of this one option.

Use the octocrab SearchHandler to implement it:

let page = octocrab::instance()
    .search()
    .repositories("tetris language:rust")
    .send()
    .await?;

The --query option is mutually exclusive with providing full repository names as positional arguments to the import command.

Update the docs to reflect the new commands and functionality

Examples:

nut import -q "owner:stefreak language:rust -fork:true"
nut import -q "org:actions language:JavaScript,TypeScript -archived:true"

This should fail with a good error message, as positional args and --query are mutually exclusive:

nut import -q "language:rust" stefreak/nut

Mention in the docs that you can use the same syntax as in the search bar on github.com (e.g. https://github.com/search?q=org%3Agithub%20language%3ATypeScript&type=repositories)

Optional: Write tests that import public repos from the user stefreak; I believe this should be possible with your available github token and it should even be possible anonymously?

Custom agent used: Señora Nut Engineer
Software Engineering Agent


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits December 1, 2025 20:17
Co-authored-by: stefreak <139624+stefreak@users.noreply.github.com>
Co-authored-by: stefreak <139624+stefreak@users.noreply.github.com>
Co-authored-by: stefreak <139624+stefreak@users.noreply.github.com>
Copilot AI changed the title [WIP] Add --query option for importing repositories feat: replace import flags with --query for GitHub search syntax Dec 1, 2025
Copilot AI requested a review from stefreak December 1, 2025 20:32
@stefreak stefreak marked this pull request as ready for review December 1, 2025 22:27
@stefreak stefreak merged commit 0eaa1c6 into main Dec 1, 2025
9 checks passed
@stefreak stefreak deleted the copilot/add-query-option-for-import branch December 1, 2025 22:30
@github-actions github-actions Bot mentioned this pull request Dec 1, 2025
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