diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..11f631f --- /dev/null +++ b/Makefile @@ -0,0 +1,50 @@ +appname := scrawl +sources := $(wildcard *.go) + +build = GOOS=$(1) GOARCH=$(2) go build -o build/$(appname)$(3) +tar = cd build && tar -cvzf $(appname)_$(1)_$(2).tar.gz $(appname)$(3) && rm $(appname)$(3) +zip = cd build && zip $(appname)_$(1)_$(2).zip $(appname)$(3) && rm $(appname)$(3) + +.PHONY: all windows darwin linux clean + +all: windows darwin linux + +clean: + rm -rf build/ + +# linux builds +linux: build/$(appname)_linux_arm.tar.gz build/$(appname)_linux_arm64.tar.gz build/$(appname)_linux_386.tar.gz build/$(appname)_linux_amd64.tar.gz + +build/$(appname)_linux_386.tar.gz: $(sources) + $(call build,linux,386,) + $(call tar,linux,386) + +build/$(appname)_linux_amd64.tar.gz: $(sources) + $(call build,linux,amd64,) + $(call tar,linux,amd64) + +build/$(appname)_linux_arm.tar.gz: $(sources) + $(call build,linux,arm,) + $(call tar,linux,arm) + +build/$(appname)_linux_arm64.tar.gz: $(sources) + $(call build,linux,arm64,) + $(call tar,linux,arm64) + +# darwin builds +darwin: build/$(appname)_darwin_amd64.tar.gz + +build/$(appname)_darwin_amd64.tar.gz: $(sources) + $(call build,darwin,amd64,) + $(call tar,darwin,amd64) + +# windows builds +windows: build/$(appname)_windows_386.zip build/$(appname)_windows_amd64.zip + +build/$(appname)_windows_386.zip: $(sources) + $(call build,windows,386,.exe) + $(call zip,windows,386,.exe) + +build/$(appname)_windows_amd64.zip: $(sources) + $(call build,windows,amd64,.exe) + $(call zip,windows,amd64,.exe) diff --git a/README.md b/README.md index 1d9124c..21a5061 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,12 @@ + + # Scrawl Scrawl is a simple command line tool for downloading files referenced on websites using [CSS @@ -14,15 +23,7 @@ If you already have the Go environment and toolchain set up, you can get the lat $ go get github.com/FooSoft/scrawl ``` -Otherwise, you can use the pre-built binaries for the platforms below: - -* [scrawl\_darwin\_386.tar.gz](https://foosoft.net/projects/scrawl/dl/scrawl_darwin_386.tar.gz) -* [scrawl\_darwin\_amd64.tar.gz](https://foosoft.net/projects/scrawl/dl/scrawl_darwin_amd64.tar.gz) -* [scrawl\_linux\_386.tar.gz](https://foosoft.net/projects/scrawl/dl/scrawl_linux_386.tar.gz) -* [scrawl\_linux\_amd64.tar.gz](https://foosoft.net/projects/scrawl/dl/scrawl_linux_amd64.tar.gz) -* [scrawl\_linux\_arm.tar.gz](https://foosoft.net/projects/scrawl/dl/scrawl_linux_arm.tar.gz) -* [scrawl\_windows\_386.tar.gz](https://foosoft.net/projects/scrawl/dl/scrawl_windows_386.tar.gz) -* [scrawl\_windows\_amd64.tar.gz](https://foosoft.net/projects/scrawl/dl/scrawl_windows_amd64.tar.gz) +Otherwise, you can use the [pre-built binaries](https://github.com/FooSoft/scrawl/releases) from the project page. ## Usage @@ -39,7 +40,7 @@ Let's say we want to create a script to download the latest Debian package of [A 1. We load up the homepage and are presented with a big download button as shown in the screenshot below: - [![Anki Homepage](https://foosoft.net/projects/scrawl/img/anki-thumb.png)](https://foosoft.net/projects/scrawl/img/anki.png) + [![Anki Homepage](img/anki-thumb.png)](img/anki.png) 2. Let's copy that link so we can download the latest version with wGet or curl from our script at any time! @@ -49,7 +50,7 @@ Let's say we want to create a script to download the latest Debian package of [A 3. Let's inspect the download link in your favorite browser to see what additional information we can get: - [![Inspector](https://foosoft.net/projects/scrawl/img/inspect-thumb.png)](https://foosoft.net/projects/scrawl/img/inspect.png) + [![Inspector](img/inspect-thumb.png)](img/inspect.png) 4. It appears that we can easily create a selector for this element: `#linux > a:nth-child(2)`. diff --git a/img/anki.png b/img/anki.png new file mode 100644 index 0000000..77bf2ca Binary files /dev/null and b/img/anki.png differ diff --git a/img/inspect.png b/img/inspect.png new file mode 100644 index 0000000..d13efc3 Binary files /dev/null and b/img/inspect.png differ