Skip to content

Commit

Permalink
Added a version flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ishanjain28 committed Sep 11, 2017
1 parent 6c89b3a commit c207a1f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 17 deletions.
38 changes: 21 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
PACKAGE=pluto
VERSION=1.4.1
VERSION=`git describe --tags`
BUILD=`date +%FT%T%z`

ARCH_LINUX = $(PACKAGE)-$(VERSION)-linux-amd64 \
$(PACKAGE)-$(VERSION)-linux-arm64 \
$(PACKAGE)-$(VERSION)-linux-386

ARCH_WIN = $(PACKAGE)-$(VERSION)-windows-amd64.exe \
$(PACKAGE)-$(VERSION)-windows-386.exe
LDFLAGS=-ldflags "-w -s -X main.Version=${VERSION} -X main.Build=${BUILD}"

TARGET = $(PACKAGE)-$(VERSION)-linux-amd64
ARCH_LINUX = $(PACKAGE)-linux-amd64 \
$(PACKAGE)-linux-arm64 \
$(PACKAGE)-linux-386

ARCH_WIN = $(PACKAGE)-windows-amd64.exe \
$(PACKAGE)-windows-386.exe

TARGET = $(PACKAGE)-linux-amd64

# TODO: Must write a configure.ac to find target for user end.
# then we can use:
Expand All @@ -23,30 +27,30 @@ dist: dist-linux dist-windows
dist-windows: $(ARCH_WIN)
dist-linux: $(ARCH_LINUX)

$(PACKAGE)-$(VERSION)-linux-arm64:
$(PACKAGE)-linux-arm64:
GOOS=linux \
GOARCH=arm64 \
go build -o=$@
go build ${LDFLAGS} -o=$@

$(PACKAGE)-$(VERSION)-linux-amd64:
$(PACKAGE)-linux-amd64:
GOOS=linux \
GOARCH=amd64 \
go build -o=$@
go build ${LDFLAGS} -o=$@

$(PACKAGE)-$(VERSION)-linux-386:
$(PACKAGE)-linux-386:
GOOS=linux \
GOARCH=386 \
go build -o=$@
go build ${LDFLAGS} -o=$@

$(PACKAGE)-$(VERSION)-windows-amd64.exe:
$(PACKAGE)-windows-amd64.exe:
GOOS=windows \
GOARCH=amd64 \
go build -o=$@
go build ${LDFLAGS} -o=$@

$(PACKAGE)-$(VERSION)-windows-386.exe:
$(PACKAGE)-windows-386.exe:
GOOS=windows \
GOARCH=386 \
go build -o=$@
go build ${LDFLAGS} -o=$@

dist-clean:
rm -f $(ARCH_WIN) $(ARCH_LINUX)
12 changes: 12 additions & 0 deletions pluto_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import (
"github.com/ishanjain28/pluto/pluto"
)

var Version string
var Build string

func main() {

sig := make(chan os.Signal, 1)
Expand All @@ -31,8 +34,17 @@ func main() {
parts := flag.Uint("part", 32, "Number of Download parts")
verbose := flag.Bool("verbose", false, "Enable Verbose Mode")
name := flag.String("name", "", "Path or Name of save File")
version := flag.Bool("version", false, "Pluto Version")

flag.Parse()

if *version {
fmt.Println("Pluto - A Fast Multipart File Downloader")
fmt.Printf("Version: %s\n", Version)
fmt.Printf("Build: %s\n", Build)
return
}

urls := []string{}

for i, v := range os.Args {
Expand Down

0 comments on commit c207a1f

Please sign in to comment.