Skip to content

Migrate from clap to facet-args#16

Open
fasterthanlime wants to merge 1 commit intomainfrom
migrate-to-facet-args
Open

Migrate from clap to facet-args#16
fasterthanlime wants to merge 1 commit intomainfrom
migrate-to-facet-args

Conversation

@fasterthanlime
Copy link
Collaborator

Summary

  • Replace clap derive macros with facet-args for CLI argument parsing
  • Use git dependencies since the published version doesn't export the help module yet
  • Manual --help handling added since facet-args doesn't intercept it automatically

Closes #13

Test plan

  • cargo build --package fontcull-cli compiles successfully
  • fontcull --help displays help text
  • fontcull --unknown shows error for unknown flags

Replace clap derive macros with facet-args, a lightweight alternative
from the facet ecosystem. This uses git dependencies for now as the
published version doesn't export the help module yet.

Closes #13
Copilot AI review requested due to automatic review settings December 3, 2025 12:11
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 migrates the CLI argument parsing from clap to facet-args, replacing derive macros and adding manual help text handling. The changes address issue #13 by switching to the facet ecosystem for argument parsing.

Key changes:

  • Replaced clap::Parser derive with facet::Facet and updated all argument attributes
  • Added manual --help handling since facet-args doesn't intercept it automatically
  • Updated dependencies to use git sources for facet packages

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
fontcull-cli/src/main.rs Replaced clap imports and derive macros with facet equivalents, converted all argument attributes to facet syntax, and added manual help handling logic
fontcull-cli/Cargo.toml Removed clap dependency and added git-based facet and facet-args dependencies

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

# CLI dependencies
clap = { version = "4", features = ["derive"] }
facet = { git = "https://github.com/facet-rs/facet" }
facet-args = { git = "https://github.com/facet-rs/facet" }
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

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

Git dependencies lack version pinning. Consider adding rev, tag, or branch specifiers to ensure reproducible builds and avoid unexpected breaking changes.

Suggested change
facet-args = { git = "https://github.com/facet-rs/facet" }
facet-args = { git = "https://github.com/facet-rs/facet", rev = "a1b2c3d4e5f6g7h8i9j0k" }

Copilot uses AI. Check for mistakes.
Comment on lines +253 to +254
let raw_args: Vec<String> = std::env::args().skip(1).collect();
if raw_args.iter().any(|a| a == "--help" || a == "-h") {
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

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

The raw_args vector is collected but only used for the help check. Consider using std::env::args().skip(1).any(|a| a == \"--help\" || a == \"-h\") to avoid the unnecessary allocation.

Suggested change
let raw_args: Vec<String> = std::env::args().skip(1).collect();
if raw_args.iter().any(|a| a == "--help" || a == "-h") {
if std::env::args().skip(1).any(|a| a == "--help" || a == "-h") {

Copilot uses AI. Check for mistakes.
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.

Migrate from clap to facet-args

2 participants