<commit_before>class NewrelicCli < Formula
  desc "Command-line interface for New Relic"
  homepage "https://github.com/newrelic/newrelic-cli"
  url "https://github.com/newrelic/newrelic-cli/archive/v0.53.2.tar.gz"
  sha256 "69abc6198d7f4889db51adfd94b2a79aaa95806bd6f09098557b05447b9afa09"
  license "Apache-2.0"
  head "https://github.com/newrelic/newrelic-cli.git", branch: "main"

  bottle do
    sha256 cellar: :any_skip_relocation, arm64_monterey: "1b13159716ba0f3e6247750c6dc19995da11d7e0bd6ce513a1c6cc59f55c29b8"
    sha256 cellar: :any_skip_relocation, arm64_big_sur:  "785b0b0d1b7c0d154cf573217eb7d4463ce7f05225ec349e3c56c35a64aa9d58"
    sha256 cellar: :any_skip_relocation, monterey:       "291854a931611849917bf25bc9078c39b501984e7fd546adef880de5ace0ee76"
    sha256 cellar: :any_skip_relocation, big_sur:        "5f81740f548586ed0581d643dbdec366f37debc3422e74fa1ec07c28d7bacf83"
    sha256 cellar: :any_skip_relocation, catalina:       "5c705b53ebe7c257ecc3a24f73b97228f1dad82b81468e9e9fff21464e41917e"
    sha256 cellar: :any_skip_relocation, x86_64_linux:   "73d05ecef0c8c7aaef80a550f9472aed5ed48c4382181a6e087c679f4befa5a8"
  end

  depends_on "go" => :build

  def install
    ENV["PROJECT_VER"] = version
    system "make", "compile-only"
    bin.install "bin/#{OS.kernel_name.downcase}/newrelic"

    output = Utils.safe_popen_read(bin/"newrelic", "completion", "--shell", "bash")
    (bash_completion/"newrelic").write output
    output = Utils.safe_popen_read(bin/"newrelic", "completion", "--shell", "zsh")
    (zsh_completion/"_newrelic").write output
    output = Utils.safe_popen_read(bin/"newrelic", "completion", "--shell", "fish")
    (fish_completion/"newrelic.fish").write output
  end

  test do
    output = shell_output("#{bin}/newrelic config list")

    assert_match "loglevel", output
    assert_match "plugindir", output
    assert_match version.to_s, shell_output("#{bin}/newrelic version 2>&1")
  end
end<commit_msg>newrelic-cli: use generate_completions DSL<commit_after>class NewrelicCli < Formula
  desc "Command-line interface for New Relic"
  homepage "https://github.com/newrelic/newrelic-cli"
  url "https://github.com/newrelic/newrelic-cli/archive/v0.53.2.tar.gz"
  sha256 "69abc6198d7f4889db51adfd94b2a79aaa95806bd6f09098557b05447b9afa09"
  license "Apache-2.0"
  head "https://github.com/newrelic/newrelic-cli.git", branch: "main"

  bottle do
    sha256 cellar: :any_skip_relocation, arm64_monterey: "1b13159716ba0f3e6247750c6dc19995da11d7e0bd6ce513a1c6cc59f55c29b8"
    sha256 cellar: :any_skip_relocation, arm64_big_sur:  "785b0b0d1b7c0d154cf573217eb7d4463ce7f05225ec349e3c56c35a64aa9d58"
    sha256 cellar: :any_skip_relocation, monterey:       "291854a931611849917bf25bc9078c39b501984e7fd546adef880de5ace0ee76"
    sha256 cellar: :any_skip_relocation, big_sur:        "5f81740f548586ed0581d643dbdec366f37debc3422e74fa1ec07c28d7bacf83"
    sha256 cellar: :any_skip_relocation, catalina:       "5c705b53ebe7c257ecc3a24f73b97228f1dad82b81468e9e9fff21464e41917e"
    sha256 cellar: :any_skip_relocation, x86_64_linux:   "73d05ecef0c8c7aaef80a550f9472aed5ed48c4382181a6e087c679f4befa5a8"
  end

  depends_on "go" => :build

  def install
    ENV["PROJECT_VER"] = version
    system "make", "compile-only"
    bin.install "bin/#{OS.kernel_name.downcase}/newrelic"

    generate_completions_from_executable(bin/"newrelic", "completion", "--shell", base_name: "newrelic")
  end

  test do
    output = shell_output("#{bin}/newrelic config list")

    assert_match "loglevel", output
    assert_match "plugindir", output
    assert_match version.to_s, shell_output("#{bin}/newrelic version 2>&1")
  end
end
{'fraction_non_alphanumeric': 0.10186199342825848, 'fraction_numerical': 0.17305585980284777, 'mean_word_length': 5.666058394160584, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3791553', 'n_tokens_mistral': 1858, 'n_tokens_neox': 1515, 'n_words': 200}