# 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.15.0"

  if OS.mac?
    url "https://download.elastic.co/downloads/ecctl/1.15.0/ecctl_1.15.0_darwin_amd64.tar.gz", :using => CurlDownloadStrategy
    sha256 "f29991d2785af5ab6c90d9e72ab2cb51c3d10a4dcc6d77103ac30cf3a9cd9ad8"
  elsif OS.linux?
    url "https://download.elastic.co/downloads/ecctl/1.15.0/ecctl_1.15.0_linux_amd64.tar.gz", :using => CurlDownloadStrategy
    sha256 "e02f6f70c4b2a1b1954b4582c6b7b72fe55cd387255c23ee25e69415a6d89d88"
  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
