From cb1f1d1a052a9704f9649e0befb5230ee400a9bb Mon Sep 17 00:00:00 2001 From: Justin Hawkins Date: Tue, 21 Feb 2017 12:28:26 +1030 Subject: [PATCH] Version and help commands. --- README.md | 9 ++++++++- dau.go | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 49416d5..54ba271 100644 --- a/README.md +++ b/README.md @@ -42,12 +42,19 @@ and the directory to watch: `--directory /some/path/here` - the directory that screenshots will appear in. -You will have to quote the path on windows, or anywhere where the directory path contains spaces. +You will have to quote the path on windows, or anywhere where the directory path contains spaces. Note that +subdirectories will also be scanned. Other parameters are: `--watch xx` - specify how many seconds to wait between scanning the directory. The default is 10 seconds. +`--username ` - an arbitrary string to show as the bot's username in the channel. + +`--help` - show command line help. + +`--version` - show the version. + ## Limitations/bugs * Only files ending jpg, gif or png are uploaded. diff --git a/dau.go b/dau.go index a4f9939..414ccbd 100644 --- a/dau.go +++ b/dau.go @@ -96,13 +96,19 @@ func parse_options() (webhook_url string, path string, watch int, username strin watchFlag := getopt.Int16Long ("watch", 's', 10, "time between scans") usernameFlag := getopt.StringLong("username", 'u', "", "username for the bot upload") helpFlag := getopt.BoolLong ("help", 'h', "help") + versionFlag := getopt.BoolLong ("version", 'v', "show version") getopt.SetParameters("") getopt.Parse() if (*helpFlag) { getopt.PrintUsage(os.Stderr) - os.Exit(1) + os.Exit(0) + } + + if (*versionFlag) { + fmt.Printf("Version: %s\n", current_version) + os.Exit(0) } if ! getopt.IsSet("directory") {