Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Add flag -v
Browse files Browse the repository at this point in the history
This change adds a new flag `-v` to show instafeed version.
  • Loading branch information
Marc Falzon authored and falzm committed Oct 15, 2019
1 parent 3b57663 commit 0013db9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Note: git tags *must* be annotated for this to work
VERSION := $(shell git describe --tags `git rev-list --tags --max-count=1` | sed 's/^[^0-9]*//')

all: instafeed

instafeed:
@go build -mod=vendor
@go build -mod=vendor -ldflags "-s -w -X main.version=$(VERSION)" -o instafeed

9 changes: 9 additions & 0 deletions instafeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ var (
configFile string
listFile string
feedMaxItems int
showVersion bool

version string
)

func init() {
Expand All @@ -32,8 +35,14 @@ func init() {
flag.StringVar(&configFile, "f", path.Join(os.Getenv("HOME"), ".instafeed"),
"Path to file where to store profile configuration")
flag.StringVar(&listFile, "l", "", "Path to file containing list of Instagram users")
flag.BoolVar(&showVersion, "v", false, "Show version and exit")
flag.IntVar(&feedMaxItems, "n", 20, "Number of user feed items")
flag.Parse()

if showVersion {
fmt.Println("instafeed", version)
os.Exit(0)
}
}

func main() {
Expand Down

0 comments on commit 0013db9

Please sign in to comment.