From 733fa02681f9986d4013777d74222693ac227b19 Mon Sep 17 00:00:00 2001 From: MoonFruit Date: Tue, 24 Oct 2023 16:24:06 +0800 Subject: [PATCH] Add macos-totp-cli --- Formula/macos-totp-cli.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Formula/macos-totp-cli.rb diff --git a/Formula/macos-totp-cli.rb b/Formula/macos-totp-cli.rb new file mode 100644 index 0000000..b1fc728 --- /dev/null +++ b/Formula/macos-totp-cli.rb @@ -0,0 +1,20 @@ +class MacosTotpCli < Formula + desc "Simple TOTP CLI, powered by keychain of macOS" + homepage "https://github.com/simnalamburt/macos-totp-cli" + url "https://github.com/simnalamburt/macos-totp-cli/archive/refs/tags/v1.0.0.tar.gz" + sha256 "afb947ac9b0cb227a302e81f6faf1f9c8bbadc169bba2445d9104cbb7200eeb2" + license any_of: ["Apache-2.0", "MIT"] + + depends_on "go" => :build + + def install + system "go", "build", *std_go_args(ldflags: "-s -w"), "-o", "totp" + bin.install "totp" + ENV["PATH"] = "#{bin}:#{ENV["PATH"]}" + generate_completions_from_executable("totp", "completion", base_name: "totp") + end + + test do + system "#{bin}/totp", "--version" + end +end