|
| 1 | +class FreshEditor < Formula |
| 2 | + desc "Text editor for your terminal: easy, powerful and fast" |
| 3 | + homepage "https://sinelaw.github.io/fresh/" |
| 4 | + url "https://github.com/sinelaw/fresh/archive/refs/tags/v0.1.18.tar.gz" |
| 5 | + sha256 "556a8349a2f3cbd1f6541a98f247ceafe1a1bf7fdb7fc4c0364f1982d99eb20e" |
| 6 | + license "GPL-2.0-or-later" |
| 7 | + |
| 8 | + bottle do |
| 9 | + sha256 cellar: :any_skip_relocation, arm64_tahoe: "ccb8e342cb9ab3b5f18a8a83ad421a1735d59485390c7e3a381b40d45c68a75a" |
| 10 | + sha256 cellar: :any_skip_relocation, arm64_sequoia: "754250b67c3a928b0677d1608863dd6bf1946488dfc50de75317d667645170f2" |
| 11 | + sha256 cellar: :any_skip_relocation, arm64_sonoma: "8d211d4566ccc233048c3a31f5ae5eeee8de0322f89b9e84c8076840eb83a334" |
| 12 | + sha256 cellar: :any_skip_relocation, sonoma: "5e35e6a2522c78f8a4af6dca38b79dd8cecc10558fb82ac64fef5625fd492373" |
| 13 | + sha256 cellar: :any_skip_relocation, arm64_linux: "b9743a0864c605bddb3fcec6578a926ed8e686b97b69d9d4791f46b17d32512a" |
| 14 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "edab7b7dedce3794e5f38eb57d67d6b409888b469e1a947b038d99573f1f6f0b" |
| 15 | + end |
| 16 | + |
| 17 | + depends_on "rust" => :build |
| 18 | + |
| 19 | + def install |
| 20 | + system "cargo", "install", *std_cargo_args(path: ".") |
| 21 | + end |
| 22 | + |
| 23 | + test do |
| 24 | + # Test script mode: type text, save, and quit |
| 25 | + commands = <<~JSON |
| 26 | + {"type":"type_text","text":"Hello from Homebrew"} |
| 27 | + {"type":"key","code":"s","modifiers":["ctrl"]} |
| 28 | + {"type":"quit"} |
| 29 | + JSON |
| 30 | + |
| 31 | + pipe_output("#{bin}/fresh --script-mode --no-session test.txt", commands) |
| 32 | + assert_match "Hello from Homebrew", (testpath/"test.txt").read |
| 33 | + end |
| 34 | +end |
0 commit comments