homebrew-core/Formula/thefuck.rb

86 lines
3.5 KiB
Ruby

class Thefuck < Formula
include Language::Python::Virtualenv
desc "Programmatically correct mistyped console commands"
homepage "https://github.com/nvbn/thefuck"
url "https://files.pythonhosted.org/packages/ac/d0/0c256afd3ba1d05882154d16aa0685018f21c60a6769a496558da7d9d8f1/thefuck-3.32.tar.gz"
sha256 "976740b9aa536726fa23cadc9a10bf457e92e335901c61fcff9152c84485ac3d"
license "MIT"
head "https://github.com/nvbn/thefuck.git", branch: "master"
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "1f9fa76d74a44429573406c73c980758fe04ce61aa5f63db02e6ef96a328d377"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "90a50f2fc6f42e39f50cbcc80f9aee8dbdcbc723a5ffddd4056f13a81116a17b"
sha256 cellar: :any_skip_relocation, monterey: "a78a2680cfd6bc2e7f37c85df30be3fd205114e2a5aeb053694b6a548f3e9cdf"
sha256 cellar: :any_skip_relocation, big_sur: "bc619209e5299d1484a4206bcb94b2f06b694ab8d4d87e33e1a76375f1f15094"
sha256 cellar: :any_skip_relocation, catalina: "67e58d863f81a0bfdca5f0cb851fe14973b907929bafa6daeff298a26839af14"
sha256 cellar: :any_skip_relocation, x86_64_linux: "974acef3f4f486b3f173d0b3b2823f64d6155b1d097c48e5278b487cbacd42ca"
end
depends_on "python@3.10"
resource "colorama" do
url "https://files.pythonhosted.org/packages/1f/bb/5d3246097ab77fa083a61bd8d3d527b7ae063c7d8e8671b1cf8c4ec10cbe/colorama-0.4.4.tar.gz"
sha256 "5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"
end
resource "decorator" do
url "https://files.pythonhosted.org/packages/92/3c/34f8448b61809968052882b830f7d8d9a8e1c07048f70deb039ae599f73c/decorator-5.1.0.tar.gz"
sha256 "e59913af105b9860aa2c8d3272d9de5a56a4e608db9a2f167a8480b323d529a7"
end
resource "psutil" do
url "https://files.pythonhosted.org/packages/47/b6/ea8a7728f096a597f0032564e8013b705aa992a0990becd773dcc4d7b4a7/psutil-5.9.0.tar.gz"
sha256 "869842dbd66bb80c3217158e629d6fceaecc3a3166d3d1faee515b05dd26ca25"
end
resource "pyte" do
url "https://files.pythonhosted.org/packages/66/37/6fed89b484c8012a0343117f085c92df8447a18af4966d25599861cd5aa0/pyte-0.8.0.tar.gz"
sha256 "7e71d03e972d6f262cbe8704ff70039855f05ee6f7ad9d7129df9c977b5a88c5"
end
resource "six" do
url "https://files.pythonhosted.org/packages/71/39/171f1c67cd00715f190ba0b100d606d440a28c93c7714febeca8b79af85e/six-1.16.0.tar.gz"
sha256 "1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"
end
resource "wcwidth" do
url "https://files.pythonhosted.org/packages/89/38/459b727c381504f361832b9e5ace19966de1a235d73cdbdea91c771a1155/wcwidth-0.2.5.tar.gz"
sha256 "c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"
end
def install
virtualenv_install_with_resources
end
def caveats
<<~EOS
Add the following to your .bash_profile, .bashrc or .zshrc:
eval $(thefuck --alias)
For other shells, check https://github.com/nvbn/thefuck/wiki/Shell-aliases
EOS
end
test do
ENV["THEFUCK_REQUIRE_CONFIRMATION"] = "false"
ENV["LC_ALL"] = "en_US.UTF-8"
output = shell_output("#{bin}/thefuck --version 2>&1")
assert_match "The Fuck #{version} using Python", output
output = shell_output("#{bin}/thefuck --alias")
assert_match "TF_ALIAS=fuck", output
output = shell_output("#{bin}/thefuck git branchh")
assert_equal "git branch", output.chomp
output = shell_output("#{bin}/thefuck echho ok")
assert_equal "echo ok", output.chomp
output = shell_output("#{bin}/fuck")
assert_match "Seems like fuck alias isn't configured!", output
end
end