From 318445b723352bed347356a6f62eb1917e7d3c97 Mon Sep 17 00:00:00 2001 From: Shaun Newman Date: Sat, 20 Oct 2018 18:20:36 -0700 Subject: [PATCH] adds more descriptive usage text --- .gitignore | 3 ++- build.sh | 7 +++++++ main.go | 11 ++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100755 build.sh diff --git a/.gitignore b/.gitignore index ec9d0e7..581403f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -lpass.csv \ No newline at end of file +lpass.csv +bin \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..f2c0d6c --- /dev/null +++ b/build.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +GOOS=darwin GOARCH=amd64 go build -o bin/lpass-auditor-osx +GOOS=windows GOARCH=amd64 go build -o bin/lpass-auditor.exe +GOOS=linux GOARCH=amd64 go build -o bin/lpass-auditor diff --git a/main.go b/main.go index 0032ea1..f1c48ee 100644 --- a/main.go +++ b/main.go @@ -1,16 +1,25 @@ package main import ( + "flag" "fmt" "os" "github.com/scnewma/lpass-auditor/command" ) +func usage() { + fmt.Fprintf(flag.CommandLine.Output(), "Usage: %s /path/to/csv\n", os.Args[0]) + flag.PrintDefaults() +} + func main() { + flag.Usage = usage + flag.Parse() + command := command.Audit{} - err := command.Execute(os.Args[1:]) + err := command.Execute(flag.Args()) if err != nil { fmt.Fprintf(os.Stderr, "error: %v", err) os.Exit(1)