# This file was generated by GoReleaser. DO NOT EDIT.
class Ecctl < Formula
  desc "Elastic Cloud Control, the official Elastic Cloud and ECE command line interface"
  homepage "https://github.com/elastic/ecctl"
  version "1.14.3"

  if OS.mac?
    url "https://download.elastic.co/downloads/ecctl/1.14.3/ecctl_1.14.3_darwin_amd64.tar.gz", :using => CurlDownloadStrategy
    sha256 "de29afc475425b133643f820926b90022d71fdf452106fbca9f24e9e70d8a248"
  elsif OS.linux?
    url "https://download.elastic.co/downloads/ecctl/1.14.3/ecctl_1.14.3_linux_amd64.tar.gz", :using => CurlDownloadStrategy
    sha256 "2a5714096b61bec64eba0addabc4879cc64c9c07f4fcac7fd39f41e221fc3def"
  end

  def install
    bin.install "ecctl"
    system "#{bin}/ecctl", "generate", "completions", "-l", "#{var}/ecctl.auto"
  end

  def caveats; <<~EOS
    To get autocompletions working make sure to run "source <(ecctl generate completions)".
    If you prefer to add to your shell interpreter configuration file run, for bash or zsh respectively:
    * `echo "source <(ecctl generate completions)" >> ~/.bash_profile`
    * `echo "source <(ecctl generate completions)" >> ~/.zshrc`.
  EOS
  end

  test do
    system "#{bin}/ecctl version"
  end
end
