Skip to content

fix: add fish omp shortcuts - #1243

Merged
shunkakinoki merged 4 commits into
mainfrom
fix/fish-omp-shortcuts
Mar 22, 2026
Merged

fix: add fish omp shortcuts#1243
shunkakinoki merged 4 commits into
mainfrom
fix/fish-omp-shortcuts

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Mar 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • add ompc and ompcp fish shortcuts for omp commit and omp commit --push
  • add ompxe and ompxeh fish helpers following the existing programs.fish.shellAbbrs + function-file convention
  • add fishtape and ShellSpec coverage for the new fish shortcuts and helper wiring

Testing

  • make fish-test
  • shellspec spec/fish_default_spec.sh

Summary by cubic

Add fish shortcuts and helpers for omp to streamline commits and free-form/headless prompts. Adds tests and tidies coverage_spec.sh to keep the shortcuts checked in CI.

  • New Features
    • Abbreviations: ompcomp commit, ompcpomp commit --push.
    • Helpers: ompxe (_ompxe_function) joins args into one prompt; ompxeh (_ompxeh_function) reads input then runs omp -p.
    • Tests/Coverage: fishtape specs for the helpers and coverage_spec.sh checks for abbreviations/registrations; removed a deprecated spec and fixed a missing End/extra blank line; run with make fish-test.

Written for commit 9cd8da0. Summary will update on new commits.

Copilot AI review requested due to automatic review settings March 22, 2026 00:46
@mesa-dot-dev

mesa-dot-dev Bot commented Mar 22, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@coderabbitai

coderabbitai Bot commented Mar 22, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR adds four new fish shell abbreviations (ompc, ompcp, ompxe, ompxeh) mapping to omp commit commands and function wrappers, along with two new fish function implementations that enable flexible command invocation and user-prompted input handling.

Changes

Cohort / File(s) Summary
Fish Configuration
home-manager/programs/fish/default.nix
Added four new shell abbreviations and registered two new fish function files (_ompxe_function.fish and _ompxeh_function.fish) in the xdg.configFile generated list.
Fish Function Implementations
home-manager/programs/fish/functions/_ompxe_function.fish, home-manager/programs/fish/functions/_ompxeh_function.fish
Implemented two new fish functions: _ompxe_function for free-form prompt handling with flexible argument passing, and _ompxeh_function for user-prompted input validation and omp invocation with print mode flag.
Fish Function Tests
spec/fish/_ompxe_function_test.fish, spec/fish/_ompxeh_function_test.fish
Added unit tests verifying _ompxe_function argument aggregation behavior (no-args and with-args cases) and _ompxeh_function input validation and omp command invocation with correct flags and arguments.
Configuration Specification Tests
spec/fish_default_spec.sh
Added Bash test spec file with grep-based assertions validating presence of all four abbreviation definitions in default.nix.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • #540: Modifies home-manager/programs/fish/default.nix to add function-based abbreviations and register corresponding fish function files following an identical code pattern.
  • #1211: Updates fish configuration entries by adding function-based abbreviations in shellAbbrs and registering corresponding fish functions in xdg.configFile.
  • #580: Adds new shell abbreviations and corresponding fish function files (including function and headless variants) to the Home Manager fish module following the same pattern.

Suggested labels

enhancement

Poem

🐰 A rabbit hops through shell commands bright,
Four abbrs now make workflows light,
ompxe prompts with tales to tell,
While ompxeh validates most well,
Our fuzzy friend commits with glee! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title directly describes the main change: adding fish shell shortcuts for the omp command.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description clearly explains the changes: adding fish shortcuts (ompc, ompcp) and helpers (ompxe, ompxeh) for omp, plus test coverage with fishtape and ShellSpec.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/fish-omp-shortcuts

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 and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 omp commands. The changes aim to improve developer productivity by providing more convenient ways to interact with omp, including direct commit commands and interactive prompt execution, all while ensuring reliability through comprehensive testing.

Highlights

  • New Fish Shortcuts: Added ompc for omp commit and ompcp for omp commit --push to streamline Git operations within the Fish shell.
  • New Fish Helpers: Introduced ompxe and ompxeh Fish helpers, following the established programs.fish.shellAbbrs and function-file convention, to provide more interactive ways to use omp.
  • Test Coverage: Included fishtape and ShellSpec tests to ensure the correct functionality and wiring of the newly added Fish shortcuts and helper functions.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mesa-dot-dev

mesa-dot-dev Bot commented Mar 22, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Adds fish shortcuts (ompc, ompcp, ompxe, ompxeh) and helper functions for omp commands to streamline commits and free-form/headless prompts, with comprehensive fishtape and ShellSpec test coverage.

What changed?

  • home-manager/programs/fish/default.nix: Added new fish shell abbreviations (ompc, ompcp) and functions (_ompxe_function, _ompxeh_function).
  • home-manager/programs/fish/functions/_ompxe_function.fish: New fish function to wrap omp, handling free-form prompts by joining arguments or calling omp directly if no arguments.
  • home-manager/programs/fish/functions/_ompxeh_function.fish: New fish function that prompts for user input, validates it, and then executes omp -p with the provided input.
  • spec/fish/_ompxe_function_test.fish: New unit tests for _ompxe_function to verify correct omp invocation with and without arguments, preserving spaces.
  • spec/fish/_ompxeh_function_test.fish: New test file for _ompxeh_function.fish covering error handling for empty prompts and correct omp -p invocation with non-empty, space-preserved prompts.
  • spec/coverage_spec.sh: Added a new test suite to verify the correct definition of ompc, ompcp, ompxe, and ompxeh fish shell abbreviations.

Description generated by Mesa. Update settings

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 6 files

@shunkakinoki
shunkakinoki enabled auto-merge (squash) March 22, 2026 00:48

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines +4 to +21
# ── 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

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

Comment on lines +7 to +16
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 / ompcp Fish abbreviations for omp commit and omp commit --push.
  • Added ompxe / ompxeh function-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.

@shunkakinoki
shunkakinoki disabled auto-merge March 22, 2026 01:59
@shunkakinoki
shunkakinoki merged commit 4cc16a3 into main Mar 22, 2026
40 checks passed
@shunkakinoki
shunkakinoki deleted the fix/fish-omp-shortcuts branch March 22, 2026 01:59
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