diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ba077a4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +bin diff --git a/Makefile b/Makefile index 0325540..2b9442d 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,15 @@ -build: - go build -o imgcat -all: build +.DEFAULT_GOAL := all + +DIST=./bin +SRC=./cmd +BINARY=$(DIST)/imgcat +BINARY_SRC=$(SRC)/imgcat +SOURCE=$(shell find $(BINARY_SRC) -name "*.go") + +$(BINARY): $(SOURCE) + go build -trimpath -o $(BINARY) $(BINARY_SRC) + +all: $(BINARY) test + +test: + $(BINARY) -url "https://images.pexels.com/photos/2558605/pexels-photo-2558605.jpeg?cs=srgb&dl=pexels-anel-rossouw-2558605.jpg&fm=jpg" -height 25 \ No newline at end of file diff --git a/README.md b/README.md index 46fe8aa..0dd8d2e 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,13 @@ make Or directly ``` -go build -o imgcat +go build -trimpath -o ./bin/imgcat ./cmd/imgcat ``` ## Usage ``` -./imgcat -url "https://images.pexels.com/photos/2558605/pexels-photo-2558605.jpeg?cs=srgb&dl=pexels-anel-rossouw-2558605.jpg&fm=jpg" -height 25 +./bin/imgcat -url "https://images.pexels.com/photos/2558605/pexels-photo-2558605.jpeg?cs=srgb&dl=pexels-anel-rossouw-2558605.jpg&fm=jpg" -height 25 ``` Capture d’écran 2021-12-11 à 17 40 55 diff --git a/main.go b/cmd/imgcat/main.go similarity index 99% rename from main.go rename to cmd/imgcat/main.go index d414a04..6dcdb3b 100644 --- a/main.go +++ b/cmd/imgcat/main.go @@ -66,5 +66,6 @@ func main() { PrintHeader(resp.ContentLength, opts.height) PrintImg(resp.Body) + PrintFooter() }