fix: add fish omp shortcuts - #1243
Conversation
|
You do not have enough credits to review this pull request. Please purchase more credits to continue. |
📝 WalkthroughWalkthroughThis PR adds four new fish shell abbreviations ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Fish shell experience by introducing new shortcuts and helper functions for common Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
Mesa DescriptionTL;DRAdds What changed?
Description generated by Mesa. Update settings |
There was a problem hiding this comment.
Code Review
This pull request adds several useful fish shortcuts and helpers for omp, along with comprehensive test coverage. The implementation is clean and follows existing conventions. I've added a couple of suggestions to improve the structure and isolation of the new test files, which will enhance their maintainability.
| # ── no args: interactive mode ───────────────────────────── | ||
| set log1 (mktemp) | ||
| function omp; echo "argc="(count $argv) >> $log1; for arg in $argv; echo "arg=$arg" >> $log1; end; end | ||
|
|
||
| _ompxe_function | ||
|
|
||
| @test "no args calls omp without prompt args" (grep -Fx -c 'argc=0' $log1) -ge 1 | ||
|
|
||
| # ── with args: builds prompt ────────────────────────────── | ||
| set log2 (mktemp) | ||
| function omp; echo "argc="(count $argv) >> $log2; for arg in $argv; echo "arg=$arg" >> $log2; end; end | ||
|
|
||
| _ompxe_function hello world | ||
|
|
||
| @test "with args passes a single prompt argument" (grep -Fx -c 'argc=1' $log2) -ge 1 | ||
| @test "with args preserves spaces in the prompt" (grep -Fx -c 'arg=hello world' $log2) -ge 1 | ||
|
|
||
| rm -f $log1 $log2 |
There was a problem hiding this comment.
To improve test isolation and avoid redefining the omp mock function in the global scope, it's better to wrap each test case in a begin...end block. This scopes the mock function and log file variables locally to each test, making the tests more robust and self-contained.
# ── no args: interactive mode ─────────────────────────────
begin
set -l log (mktemp)
function omp; echo "argc="(count $argv) >> $log; for arg in $argv; echo "arg=$arg" >> $log; end; end
_ompxe_function
@test "no args calls omp without prompt args" (grep -Fx -c 'argc=0' $log) -ge 1
rm -f $log
end
# ── with args: builds prompt ──────────────────────────────
begin
set -l log (mktemp)
function omp; echo "argc="(count $argv) >> $log; for arg in $argv; echo "arg=$arg" >> $log; end; end
_ompxe_function hello world
@test "with args passes a single prompt argument" (grep -Fx -c 'argc=1' $log) -ge 1
@test "with args preserves spaces in the prompt" (grep -Fx -c 'arg=hello world' $log) -ge 1
rm -f $log
end
| set log1 (mktemp) | ||
| function omp; echo "argc="(count $argv) >> $log1; for arg in $argv; echo "arg=$arg" >> $log1; end; end | ||
|
|
||
| echo "hello world" | _ompxeh_function | ||
|
|
||
| @test "non-empty prompt passes two arguments" (grep -Fx -c 'argc=2' $log1) -ge 1 | ||
| @test "non-empty prompt uses print mode" (grep -Fx -c 'arg=-p' $log1) -ge 1 | ||
| @test "non-empty prompt preserves spaces in the prompt" (grep -Fx -c 'arg=hello world' $log1) -ge 1 | ||
|
|
||
| rm -f $log1 |
There was a problem hiding this comment.
To improve test isolation, it's a good practice to scope mock functions and temporary files. By wrapping the test logic that uses the omp mock in a begin...end block, you can ensure the mock and its log file are local to that test case and cleaned up properly, preventing potential side effects.
begin
set -l log (mktemp)
function omp; echo "argc="(count $argv) >> $log; for arg in $argv; echo "arg=$arg" >> $log; end; end
echo "hello world" | _ompxeh_function
@test "non-empty prompt passes two arguments" (grep -Fx -c 'argc=2' $log) -ge 1
@test "non-empty prompt uses print mode" (grep -Fx -c 'arg=-p' $log) -ge 1
@test "non-empty prompt preserves spaces in the prompt" (grep -Fx -c 'arg=hello world' $log) -ge 1
rm -f $log
end
There was a problem hiding this comment.
Pull request overview
Adds new Fish shell abbreviations and helper functions for the omp CLI, along with ShellSpec and fishtape coverage to ensure the abbreviations are wired correctly and the helpers pass prompts as intended.
Changes:
- Added
ompc/ompcpFish abbreviations foromp commitandomp commit --push. - Added
ompxe/ompxehfunction-backed abbreviations plus corresponding Fish function files. - Added ShellSpec and fishtape tests covering abbreviation registration and function behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| spec/fish_default_spec.sh | ShellSpec assertions that the new omp* abbreviations are present in the Fish Home Manager config. |
| spec/fish/_ompxeh_function_test.fish | fishtape tests for the headless prompt helper (ompxeh) including error path + argument passing. |
| spec/fish/_ompxe_function_test.fish | fishtape tests for the free-form prompt helper (ompxe) for both no-arg and prompt-building paths. |
| home-manager/programs/fish/functions/_ompxeh_function.fish | Implements headless prompt-read + omp -p execution path. |
| home-manager/programs/fish/functions/_ompxe_function.fish | Implements free-form prompt joining + omp execution path. |
| home-manager/programs/fish/default.nix | Registers the new abbreviations and ensures the new function files are deployed via xdg.configFile. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
ompcandompcpfish shortcuts foromp commitandomp commit --pushompxeandompxehfish helpers following the existingprograms.fish.shellAbbrs+ function-file conventionTesting
Summary by cubic
Add
fishshortcuts and helpers forompto streamline commits and free-form/headless prompts. Adds tests and tidiescoverage_spec.shto keep the shortcuts checked in CI.ompc→omp commit,ompcp→omp commit --push.ompxe(_ompxe_function) joins args into one prompt;ompxeh(_ompxeh_function) reads input then runsomp -p.fishtapespecs for the helpers andcoverage_spec.shchecks for abbreviations/registrations; removed a deprecated spec and fixed a missingEnd/extra blank line; run withmake fish-test.Written for commit 9cd8da0. Summary will update on new commits.