From 5374408853604727233976068707eaad9a40291b Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 6 Jun 2016 12:57:28 -0600 Subject: [PATCH] Minor improvements to readme and godoc; new build script --- .gitignore | 3 +++ README.md | 52 +++++++++++++++++++++++++++++----------------------- build.bash | 21 +++++++++++++++++++++ zip.go | 3 ++- 4 files changed, 55 insertions(+), 24 deletions(-) create mode 100644 .gitignore create mode 100755 build.bash diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..2ddf8fcb --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +_gitignore +builds/ diff --git a/README.md b/README.md index 3949af5e..0949c678 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ Package archiver makes it trivially easy to make and extract .zip and .tar.gz fi Files are put into the root of the archive; directories are recursively added. +The `archiver` command runs the same cross-platform and has no external dependencies (not even libc); powered by the Go standard library. Enjoy. + ## Install @@ -12,6 +14,31 @@ Files are put into the root of the archive; directories are recursively added. go get github.com/mholt/archiver ``` +Or download from the [releases](https://github.com/mholt/archiver/releases) page. + + +## Command Use + +Make a new archive: + +```bash +$ archiver make [archive name] [input files...] +``` + +(At least one input file is required.) + +To extract an archive: + +```bash +$ archiver open [archive name] [destination] +``` + +(The destination path is optional; default is current directory.) + +The archive name must end with a supported file extension like .zip or .tar.gz—this is how it knows what kind of archive to make. + + + ## Library Use @@ -40,35 +67,14 @@ err := archiver.UntarGz("input.tar.gz", "output_folder") ``` -## Command Use - -Make a new archive: - -```bash -$ archiver make [archive name] [input files...] -``` - -(At least one input file is required.) - -To extract an archive: - -```bash -$ archiver open [archive name] [destination] -``` - -(The destination path is optional; default is current directory.) - -The archive name must end with a supported file extension like .zip or .tar.gz—this is how it knows what kind of archive to make. - - ## FAQ #### Can I list a file to go in a different folder in the archive? -No, because I didn't need it to do that. Just structure your source files to mirror the structure in the archive, like you would normally do when you make an archive using your OS. +No. Just structure your input files to mirror the structure you want in the archive, like you would normally do when you make an archive using your OS. #### Can it add files to an existing archive? -Nope. It just makes new archives or extracts existing ones. +Nope. It's a simple tool; it just makes new archives or extracts existing ones. diff --git a/build.bash b/build.bash new file mode 100755 index 00000000..8056d7ad --- /dev/null +++ b/build.bash @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -ex + +# This script builds archiver for most common platforms. + +export CGO_ENABLED=0 + +cd archiver +GOOS=linux GOARCH=386 go build -o ../builds/archiver_linux_386 +GOOS=linux GOARCH=amd64 go build -o ../builds/archiver_linux_amd64 +GOOS=linux GOARCH=arm go build -o ../builds/archiver_linux_arm7 +GOOS=linux GOARCH=arm64 go build -o ../builds/archiver_linux_arm64 +GOOS=darwin GOARCH=amd64 go build -o ../builds/archiver_mac_amd64 +GOOS=windows GOARCH=386 go build -o ../builds/archiver_windows_386.exe +GOOS=windows GOARCH=amd64 go build -o ../builds/archiver_windows_amd64.exe +GOOS=freebsd GOARCH=386 go build -o ../builds/archiver_freebsd_386 +GOOS=freebsd GOARCH=amd64 go build -o ../builds/archiver_freebsd_amd64 +GOOS=freebsd GOARCH=arm go build -o ../builds/archiver_freebsd_arm7 +GOOS=openbsd GOARCH=386 go build -o ../builds/archiver_openbsd_386 +GOOS=openbsd GOARCH=amd64 go build -o ../builds/archiver_openbsd_amd64 +cd .. \ No newline at end of file diff --git a/zip.go b/zip.go index e78c5203..b92708f6 100644 --- a/zip.go +++ b/zip.go @@ -1,4 +1,5 @@ -// Package archiver makes it super easy to create .zip and .tar.gz archives. +// Package archiver makes it super easy to create and open .zip and +// .tar.gz files. package archiver import (