This commit is contained in:
Stefan Haustein 2020-07-05 13:15:52 +02:00
commit 81717de7c4
2 changed files with 46 additions and 0 deletions

View file

@ -24,6 +24,10 @@ See the difference by disabling this optimization using the `-0` option. Or just
sudo snap install --edge tiv sudo snap install --edge tiv
### Homebrew
brew install https://raw.githubusercontent.com/stefanhaustein/TerminalImageViewer/master/terminalimageviewer.rb
### Build from source ### Build from source
sudo apt install imagemagick || yum install ImageMagick sudo apt install imagemagick || yum install ImageMagick
@ -47,6 +51,11 @@ The shell will expand wildcards. By default, thumbnails and file names will be d
- bperel has created a Docker image: - bperel has created a Docker image:
https://hub.docker.com/r/bperel/terminalimageviewer 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`. - 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 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.
## Common problems ## Common problems

37
terminalimageviewer.rb Normal file
View file

@ -0,0 +1,37 @@
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 "gcc" => :build unless OS.linux?
depends_on "imagemagick"
def install
cd "src/main/cpp" do
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
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