Skip to content

Adding a skarn completions <shell> subcommand. - #6

Merged
Rani367 merged 4 commits into
Rani367:mainfrom
swaploard:feat/shell-completions
Jun 24, 2026
Merged

Adding a skarn completions <shell> subcommand.#6
Rani367 merged 4 commits into
Rani367:mainfrom
swaploard:feat/shell-completions

Conversation

@swaploard

@swaploard swaploard commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

This PR solves (#2). Add skarn completions - a subcommand that prints a shell completion script to stdout, enabling tab-completion for all subcommands and flags.

Summary by CodeRabbit

  • New Features

    • Added a new completions CLI subcommand to generate shell completion scripts for supported shells.
    • Completion script output is printed to stdout for easy installation.
    • Updated the quickstart with an optional step to enable shell completion.
  • Documentation

    • Refreshed the README: added detailed shell completion instructions and removed an outdated landing-page blurb.
  • Tests

    • Added coverage to validate the CLI definition and that generated completion output is non-empty.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Rani367, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 53 minutes and 51 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5db034bb-99b6-480c-9dc1-ef7ce58119b0

📥 Commits

Reviewing files that changed from the base of the PR and between 6d00be3 and a9e93b0.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • README.md
  • crates/skarn/src/main.rs
📝 Walkthrough

Walkthrough

Adds a skarn completions <shell> subcommand using clap_complete. A new CompletionsArgs struct and completions() function handle script generation to stdout. The Cli struct is made public, and the Command enum gains a Completions variant wired into the main dispatch. The README Quickstart documents the optional step.

Changes

Shell Completion Feature

Layer / File(s) Summary
Dependency, argument struct, and completion generation
crates/skarn/Cargo.toml, crates/skarn/src/commands.rs, crates/skarn/src/main.rs, crates/skarn/src/*
Adds clap_complete = "4", defines CompletionsArgs { shell }, implements completions() to generate a shell completion script, makes Cli public, adds Command::Completions, wires dispatch, and adds tests that generate completion scripts for multiple shells.
README Quickstart documentation
README.md
Removes the landing-page blurb line and adds Quickstart step 6 with a zsh completion example and .zshrc setup instructions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Poem

🐇 I hop through shells with a tab-tap cheer,
Zsh, Fish, and Bash now draw near.
A tiny script lands in the stream,
Skarn completions in a bunny dream.
compinit hums, the fpath is set — hop hop,
The terminal twinkles; the cursor won’t stop.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a new skarn completions <shell> subcommand.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Around line 84-86: The shell completion install example in README should
create the target directory before redirecting output, since the skarn
completions zsh command will fail on fresh systems if ~/.zfunc is missing.
Update the completion setup instructions to include a directory creation step
before the redirect, keeping the guidance alongside the existing zsh completion
example and the compinit/fpath note.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 047c822e-40f1-445b-a7c4-8824eddbe868

📥 Commits

Reviewing files that changed from the base of the PR and between 06c6933 and 8087fd5.

📒 Files selected for processing (4)
  • README.md
  • crates/skarn/Cargo.toml
  • crates/skarn/src/commands.rs
  • crates/skarn/src/main.rs

Comment thread README.md
Comment on lines +84 to +86
# 6. (Optional) install shell completion (bash/zsh/fish/powershell):
# skarn completions zsh > ~/.zfunc/_skarn
# Then add `fpath+=~/.zfunc` and `compinit` to your .zshrc

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add directory creation before redirecting completion output.

Line 85 can fail on clean setups if ~/.zfunc does not exist.

Suggested doc patch
 # 6. (Optional) install shell completion (bash/zsh/fish/powershell):
-#    skarn completions zsh > ~/.zfunc/_skarn
-#    Then add `fpath+=~/.zfunc` and `compinit` to your .zshrc
+#    mkdir -p ~/.zfunc
+#    skarn completions zsh > ~/.zfunc/_skarn
+#    Then add `fpath=(~/.zfunc $fpath)` and `autoload -Uz compinit && compinit` to your .zshrc
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# 6. (Optional) install shell completion (bash/zsh/fish/powershell):
# skarn completions zsh > ~/.zfunc/_skarn
# Then add `fpath+=~/.zfunc` and `compinit` to your .zshrc
# 6. (Optional) install shell completion (bash/zsh/fish/powershell):
# mkdir -p ~/.zfunc
# skarn completions zsh > ~/.zfunc/_skarn
# Then add `fpath=(~/.zfunc $fpath)` and `autoload -Uz compinit && compinit` to your .zshrc
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 84 - 86, The shell completion install example in
README should create the target directory before redirecting output, since the
skarn completions zsh command will fail on fresh systems if ~/.zfunc is missing.
Update the completion setup instructions to include a directory creation step
before the redirect, keeping the guidance alongside the existing zsh completion
example and the compinit/fpath note.

@Rani367 Rani367 closed this Jun 24, 2026
@Rani367 Rani367 reopened this Jun 24, 2026
- Remove unused clap::CommandFactory import in main.rs (was failing CI
  under RUSTFLAGS=-D warnings / clippy -D warnings).
- Commit the Cargo.lock entry for clap_complete (was missing).
- Collapse the stray double blank line left in the README.
- Add smoke tests: validate the CLI definition and that completion
  scripts generate for every supported shell.
@Rani367
Rani367 force-pushed the feat/shell-completions branch from 6d00be3 to f1ecd6d Compare June 24, 2026 15:43
@Rani367
Rani367 merged commit 96f0803 into Rani367:main Jun 24, 2026
1 check passed
@Rani367

Rani367 commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Merged — thanks for the contribution, @swaploard! 🙏

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