Skip to content

Instantly share code, notes, and snippets.

@ryan-williams
Last active November 9, 2025 18:42
Show Gist options
  • Select an option

  • Save ryan-williams/27b3cd986701b6d354a404ef951b385e to your computer and use it in GitHub Desktop.

Select an option

Save ryan-williams/27b3cd986701b6d354a404ef951b385e to your computer and use it in GitHub Desktop.

runsascoded/dffs#3 Add shell-integration, -C/--cached flag, fix exit codes, modernize CI

Summary

  • Add dffs-shell-integration command for convenient shell aliases with c (back-compat) and n (no-color) variants
  • Add -C/--cached flag to git-diff-x for comparing HEAD vs staged changes
  • Fix exit code propagation in git-diff-x and comm-x
  • Improve test assertions: replace vague in checks with precise line-by-line comparisons
  • Remove deprecated Tuple import, use built-in tuple
  • Update CI workflow to match ghpr/git-didi pattern

Shell Integration

New dffs-shell-integration command outputs aliases:

eval "$(dffs-shell-integration bash)"           # All aliases
eval "$(dffs-shell-integration bash diff-x)"    # Only diff-x aliases
eval "$(dffs-shell-integration bash comm-x)"    # Only comm-x aliases
eval "$(dffs-shell-integration bash git-diff-x)" # Only git-diff-x aliases

Aliases provided (color enabled by default):

  • diff-x: dx, dxc (back-compat), dxn (no-color), dxw, dxcw, dxwn
  • comm-x: cx, cx1, cx2, cx3, cx12, cx13, cx23
  • git-diff-x: gdx, gdxc (back-compat), gdxn (no-color), plus variants:
    • gdxs/gdxcs/gdxsn = compare HEAD vs staged (--cached)
    • gdxr/gdxcr/gdxrn = compare refspec (-r)
    • gdxf/gdxcf/gdxfn = compare single ref (-R)
    • gdxw/gdxcw/gdxwn = ignore whitespace (-w)
    • Combinations: gdxsw, gdxcsw, gdxswn, gdxrw, gdxcrw, gdxrwn, gdxfw, gdxcfw, gdxfwn
    • c variants are vestigial (same as base) for backward compatibility
    • n variants add --no-color

git-diff-x --cached

Compare HEAD vs staged changes (like git diff --cached):

git-diff-x --cached jq. file.json
# Or use alias:
gdxs jq. file.json

Exit Code Fixes

git-diff-x and comm-x now properly exit non-zero when pipeline commands fail (e.g., when a file doesn't exist in HEAD).

CI Improvements

  • Separate jobs for build, TestPyPI, and PyPI publishing
  • Trusted publishing with OIDC tokens
  • RC tags publish to TestPyPI
  • Include tag annotation in GitHub releases

Test Plan

  • ✓ All 61 tests pass
  • ✓ Shell integration works for bash/zsh
  • ✓ Filtering by CLI works correctly
  • -C flag compares HEAD vs staged changes
  • ✓ Exit codes propagate from failed pipelines

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment