Skip to content

Commit

Permalink
feat: Generate shell completions on install
Browse files Browse the repository at this point in the history
Homebrew can automatically generate and install completions for bash,
zsh, and fish. For now, completion is limited to bash and zsh until
graphite adds fish support.

This simplifies the installation steps for homebrew users.
  • Loading branch information
jalaziz committed Feb 9, 2023
1 parent af77592 commit 295d3c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Formula/graphite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
class Graphite < Formula
desc "The Graphite CLI allows you to easily manage your stacked-diff workflow."
homepage "https://graphite.dev/"
url "https://github.com/withgraphite/graphite-cli/archive/v0.20.11.zip"
sha256 "2458a015ba46c636b138fec424cd26ffa09430369f5420672cb14329147233d0"
version "0.20.11"
url "https://github.com/withgraphite/graphite-cli/archive/v0.20.13.zip"
sha256 "e5bbc20efa6838af2f78413d8cfc44957500af48b96d310faea49cda784e9207"
version "0.20.13"
license "None"

depends_on "node@16"

def install
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
bin.install_symlink Dir["#{libexec}/bin/*"]

generate_completions_from_executable(libexec/"bin/gt", "completion", shells: [:bash, :zsh])
end

test do
Expand Down
2 changes: 2 additions & 0 deletions formula-templates/graphite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class Graphite < Formula
def install
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
bin.install_symlink Dir["#{libexec}/bin/*"]

generate_completions_from_executable(libexec/"bin/gt", "completion", shells: [:bash, :zsh])
end

test do
Expand Down

0 comments on commit 295d3c7

Please sign in to comment.