Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git-delta: update completion generation step and update test #201834

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions Formula/g/git-delta.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,25 @@ class GitDelta < Formula

def install
system "cargo", "install", *std_cargo_args
bash_completion.install "etc/completion/completion.bash" => "delta"
fish_completion.install "etc/completion/completion.fish" => "delta.fish"
zsh_completion.install "etc/completion/completion.zsh" => "_delta"

generate_completions_from_executable(bin/"delta", "--generate-completion", base_name: "delta")
end

test do
assert_match "delta #{version}", `#{bin}/delta --version`.chomp
assert_match "delta #{version}", shell_output("#{bin}/delta --version")

# Create a test repo
system "git", "init"
(testpath/"test.txt").write("Hello, Homebrew!")
system "git", "add", "test.txt"
system "git", "commit", "-m", "Initial commit"
(testpath/"test.txt").append_lines("Hello, Delta!")
system "git", "add", "test.txt"
system "git", "commit", "-m", "Update test.txt"

# Test delta with git log using pipe_output
git_log_output = shell_output("git log -p --color=always")
output = pipe_output(bin/"delta", git_log_output)
assert_match "Hello, Delta!", output
end
end
Loading