From b3b942bb418a788a2a59ccc006e8549f5679f320 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Thu, 9 Apr 2020 17:57:30 +0800 Subject: [PATCH 1/5] Homebrew! Should close #60 --- terminalimageviewer.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 terminalimageviewer.rb diff --git a/terminalimageviewer.rb b/terminalimageviewer.rb new file mode 100644 index 0000000..1231af6 --- /dev/null +++ b/terminalimageviewer.rb @@ -0,0 +1,23 @@ +class Terminalimageviewer < Formula + desc "Display images in a terminal using block graphic characters" + homepage "https://github.com/stefanhaustein/TerminalImageViewer" + url "https://github.com/stefanhaustein/TerminalImageViewer/archive/v1.0.0.tar.gz" + sha256 "d28c5746d25d83ea707db52b54288c4fc1851c642ae021951967e69296450c8c" + head "https://github.com/stefanhaustein/TerminalImageViewer.git" + depends_on "imagemagick" + + def install + cd "src/main/cpp" do + # No expermimental/filesystem.h on clang + system "make" + bin.install "tiv" + end + end + + test do + # Downloads a public domain test file from wikimedia commons and displays it. + # For some reason, when you redirect the output it is blank. + assert_equal "", + shell_output("#{bin}/tiv -0 https://upload.wikimedia.org/wikipedia/commons/2/24/Cornell_box.png").strip + end +end From 58ff3e47e64814683c2ca3486d1ee8b79e4b0c1b Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Thu, 9 Apr 2020 18:10:30 +0800 Subject: [PATCH 2/5] Homebrew! Note that the `brew install` way only works after you've merged my fork. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index d343e5c..a864efb 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,10 @@ See the difference by disabling this optimization using the `-0` option. Or just sudo snap install --edge tiv +### Homebrew + + brew install https://raw.githubusercontent.com/stefanhaustein/TerminalImageViewer/master/terminalimageviewer.rb + ### Build from source sudo apt install imagemagick || yum install ImageMagick From f78b65c1f375e688c7500f644a1766e48b783933 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Thu, 9 Apr 2020 18:13:40 +0800 Subject: [PATCH 3/5] Homebrew! Almost forgot to add macOS support --- terminalimageviewer.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/terminalimageviewer.rb b/terminalimageviewer.rb index 1231af6..0353528 100644 --- a/terminalimageviewer.rb +++ b/terminalimageviewer.rb @@ -4,12 +4,26 @@ class Terminalimageviewer < Formula url "https://github.com/stefanhaustein/TerminalImageViewer/archive/v1.0.0.tar.gz" sha256 "d28c5746d25d83ea707db52b54288c4fc1851c642ae021951967e69296450c8c" head "https://github.com/stefanhaustein/TerminalImageViewer.git" + depends_on "gcc" => :build unless OS.linux? depends_on "imagemagick" def install cd "src/main/cpp" do - # No expermimental/filesystem.h on clang system "make" + if OS.mac? + # No expermimental/filesystem.h on mac + system "#{Formula["gcc"].opt_bin}/gcc-#{Formula["gcc"].version_suffix}", "-std=c++17", + "-Wall", + "-fpermissive", + "-fexceptions", + "-O2", "-c", + "tiv.cpp", "-o", "tiv.o" + system "#{Formula["gcc"].opt_bin}/gcc-#{Formula["gcc"].version_suffix}", "tiv.o", "-o", + "tiv", "-lstdc++fs", + "-pthread", "-s" + else + system "make" + end bin.install "tiv" end end From 8065da142ea995e53361d130c947d1d405ba7ec7 Mon Sep 17 00:00:00 2001 From: Stefan Haustein Date: Mon, 1 Jun 2020 14:15:32 +0200 Subject: [PATCH 4/5] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index a864efb..a7ff207 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,10 @@ The shell will expand wildcards. By default, thumbnails and file names will be d https://hub.docker.com/r/bperel/terminalimageviewer - teresaejunior has created a snapcraft.yaml file, which can build a Snap package with `sudo docker run -it --rm -v "$PWD:$PWD" -w "$PWD" snapcore/snapcraft sh -c 'apt-get update && snapcraft'`, and then installed with `sudo snap install --dangerous ./*.snap`. +I am happy to accept useful contributions, but it might make sense to file an issue to discuss the approach before investing large amounts of time. + +Support for additional platforms, cpus or similar will require somebody who is happy to help with maintenance, in particular, if I don't have access to it. + ## Common problems - If you see strange horizontal lines, the characters don't fully fill the character cell. Remove additional line spacing in your terminal app From 397f4ea580420370b79c9cd1edc37d6560f49ba5 Mon Sep 17 00:00:00 2001 From: Stefan Haustein Date: Mon, 1 Jun 2020 14:18:22 +0200 Subject: [PATCH 5/5] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a7ff207..9c7e869 100644 --- a/README.md +++ b/README.md @@ -51,10 +51,11 @@ The shell will expand wildcards. By default, thumbnails and file names will be d - bperel has created a Docker image: https://hub.docker.com/r/bperel/terminalimageviewer - teresaejunior has created a snapcraft.yaml file, which can build a Snap package with `sudo docker run -it --rm -v "$PWD:$PWD" -w "$PWD" snapcore/snapcraft sh -c 'apt-get update && snapcraft'`, and then installed with `sudo snap install --dangerous ./*.snap`. + - aaronliu0130 has added brew support. -I am happy to accept useful contributions, but it might make sense to file an issue to discuss the approach before investing large amounts of time. +I am happy to accept useful contributions under the Apache 2.0 licencse, but it might make sense to file an issue to discuss the approach before investing large amounts of time. -Support for additional platforms, cpus or similar will require somebody who is happy to help with maintenance, in particular, if I don't have access to it. +Support for additional platforms, CPUs or similar will require somebody who is happy to help with maintenance, in particular, if I don't have access to it. ## Common problems