Add -h, --version, and --help options.

This commit is contained in:
Jonathan Bernard 2017-08-23 15:17:18 -05:00
parent b0e6e4d66f
commit 3a745ac98f
2 changed files with 9 additions and 4 deletions

View File

@ -35,7 +35,7 @@ when isMainModule:
var outFile: File
try:
let VERSION = "0.1.0"
let VERSION = "0.2.0"
let usage = """
Usage:
log_happy [options]
@ -44,7 +44,8 @@ Usage:
Options:
-v Print version information and exit.
-h --help Print this usage information and exit.
-v --version Print version information and exit.
-e<label>;<pattern> Add something to expect to see in the log stream.
-E<label>;<patterh> Add something to expect not to see in the log stream.
-d<def-file> Read expectations from a JSON definitions file.
@ -136,10 +137,14 @@ Expectations JSON definitions follow this format:
expected: m[0] == "e",
found: false))
elif arg == "-v":
elif arg == "-v" or arg == "--version":
stdout.writeLine "log_happy v" & VERSION
quit(QuitSuccess)
elif arg == "-h" or arg == "--help":
stdout.writeLine usage
quit(QuitSuccess)
elif arg == "-f": follow = true
elif arg == "--": cmd = ""
else: exitErr "unrecognized argument: " & arg

View File

@ -1,6 +1,6 @@
# Package
version = "0.1.0"
version = "0.2.0"
author = "Jonathan Bernard"
description = "Scan logs for regex-defined events and report on what was found."
license = "MIT"