From a5c66a6afdec92f4a5a06cc5fcc24d5400686594 Mon Sep 17 00:00:00 2001 From: Dominik Agres Date: Mon, 22 Jun 2026 23:07:50 +0200 Subject: [PATCH] fix cheatsh --- Formula/cheatsh.rb | 41 ++++++++++++++++------------------------- README.md | 4 ++-- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/Formula/cheatsh.rb b/Formula/cheatsh.rb index 5a06387..006be9c 100644 --- a/Formula/cheatsh.rb +++ b/Formula/cheatsh.rb @@ -1,41 +1,32 @@ class Cheatsh < Formula - desc "a terminal cheat sheet for linux" + desc "Terminal cheat sheet TUI for commands you keep forgetting" homepage "https://github.com/agresdominik/cheat_sheet" - version "0.1.2" - url "https://github.com/agresdominik/cheat_sheet/archive/refs/tags/v0.1.2.tar.gz" - sha256 "b6df830340da71fbe85d972c82432479f8c4d45f821cad489c6ef2e719d88152" - license "GPL-3.0" + url "https://github.com/agresdominik/cheat_sheet/archive/refs/tags/v0.1.2.tar.gz" + sha256 "b6df830340da71fbe85d972c82432479f8c4d45f821cad489c6ef2e719d88152" + license "GPL-3.0-only" depends_on "go" => :build def install - system "make", "install", - "PREFIX=#{prefix}", - "SYSCONFDIR=#{etc}/cheatsh" - end - - def post_install - config_dir = "#{Dir.home}/.config/cheatsh" - FileUtils.mkdir_p config_dir - - ["commands.json", "commands_template.json"].each do |f| - src = "#{etc}/cheatsh/#{f}" - dest = "#{config_dir}/#{f}" - FileUtils.cp(src, dest) - end + system "go", "build", *std_go_args(output: bin/"cheatsh"), "./src" + pkgshare.install "data/commands.json", "data/commands_template.json" end def caveats <<~EOS - Default config files are stored in: - #{etc}/cheatsh/ - - To set up your config on first run: - cp #{etc}/cheatsh/commands_template.json ~/.config/cheatsh/ + cheatsh uses the bundled command list by default (updated on `brew upgrade`): + #{opt_pkgshare}/commands.json + + To use your own list, copy the template and pass it explicitly: + cp #{opt_pkgshare}/commands_template.json ~/my-commands.json + cheatsh --config ~/my-commands.json + + Copying to the clipboard needs a backend on Linux: + wl-clipboard (Wayland) or xsel / xclip (X11). macOS works out of the box. EOS end test do - system "#{bin}/myapp", "--help" + assert_match "Usage", shell_output("#{bin}/cheatsh --help") end end diff --git a/README.md b/README.md index 3d63f0c..3b5e7aa 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ brew tap agresdominik/repo https://github.com/agresdominik/repo ### cheatsh -```brew -brew install cheatsh +```bash +brew install agresdominik/repo/cheatsh ``` Visit [cheat_sheet](https://github.com/agresdominik/cheat_sheet) to see more info