Skip to content

Conversation

@kurotych
Copy link
Owner

@kurotych kurotych commented Oct 18, 2025

Makes it possible to use sqlant as library without clap dependency

@kurotych kurotych requested a review from Copilot November 22, 2025 09:32
@kurotych kurotych marked this pull request as ready for review November 22, 2025 09:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR successfully decouples the CLI functionality from the library code, allowing sqlant to be used as a library without requiring the clap dependency. The changes move the cli module from being public in lib.rs to being a private module in main.rs, and make clap an optional dependency controlled by a feature flag.

Key Changes:

  • Moved CLI module from lib.rs to main.rs and made clap an optional dependency
  • Configured Cargo to only build the binary when the "cli" feature is enabled
  • Added CI test to verify library usage without clap dependency

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/main.rs Declares cli module locally and updates function call from sqlant::cli::parse() to cli::parse()
src/lib.rs Removes public cli module declaration, keeping only core library modules
Cargo.toml Makes clap optional via "cli" feature, adds binary configuration with required features, includes "cli" in default features
.github/workflows/ci.yml Adds comprehensive test job to verify library can be used without clap dependency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Create a simple lib.rs that uses sqlant
cat > src/lib.rs << 'EOF'
use sqlant::{GeneratorType, get_generator};
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

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

[nitpick] The imported get_generator function is not used in the test code. Consider removing it from the imports to keep the test minimal and clear.

Suggested change
use sqlant::{GeneratorType, get_generator};
use sqlant::GeneratorType;

Copilot uses AI. Check for mistakes.
@kurotych kurotych merged commit 0f76f3c into main Nov 22, 2025
4 checks passed
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